-
Notifications
You must be signed in to change notification settings - Fork 590
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: bump aws sdk, use rustls in s3 client #13286
Conversation
Signed-off-by: MrCroxx <[email protected]>
pub fn new_http_client(config: &S3ObjectStoreConfig) -> impl HttpClient { | ||
let mut http = hyper::client::HttpConnector::new(); | ||
|
||
// connection config | ||
if let Some(keepalive_ms) = config.keepalive_ms.as_ref() { | ||
http.set_keepalive(Some(Duration::from_millis(*keepalive_ms))); | ||
} | ||
// connection config | ||
if let Some(keepalive_ms) = config.keepalive_ms.as_ref() { | ||
http.set_keepalive(Some(Duration::from_millis(*keepalive_ms))); | ||
} | ||
|
||
if let Some(nodelay) = config.nodelay.as_ref() { | ||
http.set_nodelay(*nodelay); | ||
} | ||
if let Some(nodelay) = config.nodelay.as_ref() { | ||
http.set_nodelay(*nodelay); | ||
} | ||
|
||
if let Some(recv_buffer_size) = config.recv_buffer_size.as_ref() { | ||
http.set_recv_buffer_size(Some(*recv_buffer_size)); | ||
} | ||
if let Some(recv_buffer_size) = config.recv_buffer_size.as_ref() { | ||
http.set_recv_buffer_size(Some(*recv_buffer_size)); | ||
} | ||
|
||
if let Some(send_buffer_size) = config.send_buffer_size.as_ref() { | ||
http.set_send_buffer_size(Some(*send_buffer_size)); | ||
} | ||
if let Some(send_buffer_size) = config.send_buffer_size.as_ref() { | ||
http.set_send_buffer_size(Some(*send_buffer_size)); | ||
} | ||
|
||
http.enforce_http(false); | ||
hyper_tls::HttpsConnector::from((http, tls.into())) | ||
}; | ||
http.enforce_http(false); | ||
|
||
let conn = hyper_rustls::HttpsConnectorBuilder::new() | ||
.with_webpki_roots() | ||
.https_or_http() | ||
.enable_all_versions() | ||
.wrap_connector(http); | ||
|
||
aws_smithy_client::hyper_ext::Adapter::builder() | ||
.hyper_builder(hyper::client::Builder::default()) | ||
.connector_settings(ConnectorSettings::builder().build()) | ||
.build(monitor_connector(native_tls, "S3")) | ||
let conn = monitor_connector(conn, "S3"); | ||
|
||
HyperClientBuilder::new().build(conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #13286 +/- ##
==========================================
+ Coverage 67.85% 67.88% +0.02%
==========================================
Files 1526 1526
Lines 259938 259940 +2
==========================================
+ Hits 176392 176456 +64
+ Misses 83546 83484 -62
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
[[patch.unused]] | ||
name = "getrandom" | ||
version = "0.2.9" | ||
source = "git+https://github.com/madsim-rs/getrandom.git?rev=8daf97e#8daf97e4142635fe28543b2db9022f5e2544bb5c" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, madsim also needs to update the dependency. I'll change to madsim source when @wangrunji0408 publishes the new version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
published as madsim-aws-sdk-s3 v0.3.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, getrandom has updated to v0.2.11 some days ago. Although there's nothing important according to its changelog. If we are going to bump its version, remember to bump the patch version as well:
# Cargo.toml
getrandom = { git = "https://github.com/madsim-rs/getrandom.git", rev = "e79a7ae" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to bump its version, remember to bump the patch version as well:
It was eventually forgotten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣
Cargo.toml
Outdated
aws-config = { version = "0.57", default-features = false, features = [ | ||
"rt-tokio", | ||
"native-tls", | ||
] } | ||
aws-credential-types = { version = "0.55", default-features = false, features = [ | ||
aws-credential-types = { version = "0.57", default-features = false, features = [ | ||
"hardcoded-credentials", | ||
] } | ||
aws-sdk-kinesis = { version = "0.28", default-features = false, features = [ | ||
aws-sdk-kinesis = { version = "0.35", default-features = false, features = [ | ||
"rt-tokio", | ||
"native-tls", | ||
] } | ||
aws-sdk-s3 = { version = "0.28", default-features = false, features = [ | ||
aws-sdk-s3 = { version = "0.35", default-features = false, features = [ | ||
"rt-tokio", | ||
"native-tls", | ||
] } | ||
aws-sdk-ec2 = { version = "0.28", default-features = false, features = [ | ||
aws-sdk-ec2 = { version = "0.35", default-features = false, features = [ | ||
"rt-tokio", | ||
"native-tls", | ||
] } | ||
aws-sdk-sqs = { version = "0.28", default-features = false, features = [ | ||
aws-sdk-sqs = { version = "0.35", default-features = false, features = [ | ||
"rt-tokio", | ||
"native-tls", | ||
] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we forget to enable the rustls
feature here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Is there any way to test if rustls is enabled and https is working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you try to connect to S3 via ec2 in the same region without setting the endpoint explicitly, I think https is used by default. You can also set RW_S3_ENDPOINT
explicitly with https://....
.
Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
src/object_store/src/object/s3.rs
Outdated
@@ -293,7 +294,9 @@ impl StreamingUploader for S3StreamingUploader { | |||
|
|||
fn get_upload_body(data: Vec<Bytes>) -> ByteStream { | |||
SdkBody::retryable(move || { | |||
Body::wrap_stream(stream::iter(data.clone().into_iter().map(ObjectResult::Ok))).into() | |||
SdkBody::from_body_0_4(Body::wrap_stream(stream::iter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does from_body_0_4
come from? Any documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Now it uses hyper-0-14-x
, which matches our deps.
Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
The PR bumped Line 244 in 2df34ee
|
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Bump aws sdk version to latest. Replace
native-tls
withrustls
for s3 client because aws sdk doesn't support it anymore.close #9503 #11842 #11852
Checklist
./risedev check
(or alias,./risedev c
)Documentation
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.