Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(source): refactor s3 source WITH options handling #14190

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Dec 25, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

  1. remove the if in extract

    IIUC, previously we need the if here because s3_v2 and s3 shares the same config struct, and thus the macro cannot dispatch correctly. Since we have separated types now, the special treatment seems unnecessary and confusing.

  2. Share a S3PropertiesCommon, instead of the top-level S3Properties. This corresponds to the pattern described in feat(source): deny unknown fields for WITH options #13654 (comment) . (We need to add unknown_fields in both the top-level structs later..)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@xxchan
Copy link
Member Author

xxchan commented Dec 25, 2023

😟
image

@xxchan
Copy link
Member Author

xxchan commented Dec 25, 2023

Wait, it seems this is also failing on main...

@xxchan xxchan requested review from tabVersion and wcy-fdu December 25, 2023 11:38
@xxchan xxchan force-pushed the 12-25-refactor_source_remove_unnecessary_Box_for_NexmarkProperties branch from c33129f to 64b9ed0 Compare December 25, 2023 12:13
@xxchan xxchan force-pushed the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch from d6e8b64 to 1ff6db4 Compare December 25, 2023 12:13
@xxchan xxchan changed the title refactor(source): unify s3_v2 handling in ConnectorProperties::extract refactor(source): refactor s3 source WITH options handling Dec 25, 2023
@wcy-fdu
Copy link
Contributor

wcy-fdu commented Dec 26, 2023

Hmm... I also find that currently both s3 and s3_v2 can not work, and can be reproduced locally. I suspect it's a bug introduced by some recent PRs, any ideas? cc @tabVersion

Base automatically changed from 12-25-refactor_source_remove_unnecessary_Box_for_NexmarkProperties to main December 26, 2023 04:34
@xxchan xxchan force-pushed the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch from 71d2b0f to ecba13b Compare December 26, 2023 05:10
@tabVersion
Copy link
Contributor

tabVersion commented Dec 26, 2023

suspect #13707 breaks s3 or parser parts, may suspend the pr and wait for @Rossil2012 find out why.

#14196

@xxchan
Copy link
Member Author

xxchan commented Dec 26, 2023

It seems we can't land #13654 in 1.6

@xxchan xxchan force-pushed the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch from ecba13b to e44b49f Compare December 27, 2023 03:14
@xxchan
Copy link
Member Author

xxchan commented Dec 27, 2023

s3 source tests passed @tabVersion

https://buildkite.com/risingwavelabs/main-cron/builds/1415

@xxchan xxchan requested review from tabVersion and wcy-fdu and removed request for tabVersion and wcy-fdu December 27, 2023 05:02
Comment on lines -389 to -403
match connector.as_str() {
"s3_v2" => {
let assume_role = with_properties.get("s3.assume_role").cloned();
return Ok(ConnectorProperties::OpendalS3(Box::new(
OpendalS3Properties {
s3_properties: S3Properties::try_from_hashmap(with_properties)?,
assume_role,
},
)));
}
"gcs" => {
return Ok(ConnectorProperties::Gcs(Box::new(
GcsProperties::try_from_hashmap(with_properties)?,
)));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's the dispatch logic going

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Do you remember why the dispatch is needed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, previously we need the if here because s3_v2 and s3 shares the same config struct, and thus the macro cannot dispatch correctly. Since we have separated types now, the special treatment seems unnecessary and confusing.

I mentioned in the PR description

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

match_source_name_str takes care of all cases, which I think goes to this in the lowest level

{ S3, $crate::source::filesystem::S3Properties, $crate::source::filesystem::FsSplit },
{ Gcs, $crate::source::filesystem::opendal_source::GcsProperties , $crate::source::filesystem::OpendalFsSplit<$crate::source::filesystem::opendal_source::OpendalGcs> },
{ OpendalS3, $crate::source::filesystem::opendal_source::OpendalS3Properties, $crate::source::filesystem::OpendalFsSplit<$crate::source::filesystem::opendal_source::OpendalS3> },

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shipshipship

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for helping me remember the structure. No more question.

Copy link
Contributor

@tabVersion tabVersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

@xxchan xxchan added this pull request to the merge queue Dec 27, 2023
Merged via the queue into main with commit 476daec Dec 27, 2023
39 of 41 checks passed
@xxchan xxchan deleted the 12-25-refactor_source_unify_s3_v2_handling_in_ConnectorProperties_extract branch December 27, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants