Skip to content

Commit 6702d41

Browse files
authored
Add config option for disabling S3 SDK stalled stream protection (#6339)
1 parent 10d109e commit 6702d41

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

quickwit/quickwit-config/src/storage_config.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ pub struct S3StorageConfig {
331331
pub disable_multipart_upload: bool,
332332
#[serde(default)]
333333
pub disable_checksums: bool,
334+
#[serde(default)]
335+
pub disable_stalled_stream_protection_upload: bool,
336+
#[serde(default)]
337+
pub disable_stalled_stream_protection_download: bool,
334338
}
335339

336340
impl S3StorageConfig {
@@ -399,6 +403,16 @@ impl fmt::Debug for S3StorageConfig {
399403
"disable_multi_object_delete",
400404
&self.disable_multi_object_delete,
401405
)
406+
.field("disable_multipart_upload", &self.disable_multipart_upload)
407+
.field("disable_checksums", &self.disable_checksums)
408+
.field(
409+
"disable_stalled_stream_protection_upload",
410+
&self.disable_stalled_stream_protection_upload,
411+
)
412+
.field(
413+
"disable_stalled_stream_protection_download",
414+
&self.disable_stalled_stream_protection_download,
415+
)
402416
.finish()
403417
}
404418
}
@@ -634,6 +648,8 @@ mod tests {
634648
disable_multi_object_delete_requests: true
635649
disable_multipart_upload: true
636650
disable_checksums: true
651+
disable_stalled_stream_protection_upload: true
652+
disable_stalled_stream_protection_download: true
637653
"#;
638654
let s3_storage_config: S3StorageConfig =
639655
serde_yaml::from_str(s3_storage_config_yaml).unwrap();
@@ -645,6 +661,8 @@ mod tests {
645661
disable_multi_object_delete: true,
646662
disable_multipart_upload: true,
647663
disable_checksums: true,
664+
disable_stalled_stream_protection_upload: true,
665+
disable_stalled_stream_protection_download: true,
648666
..Default::default()
649667
};
650668
assert_eq!(s3_storage_config, expected_s3_config);

quickwit/quickwit-storage/src/object_storage/s3_compatible_storage.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::{fmt, io};
2222

2323
use anyhow::{Context as AnyhhowContext, anyhow};
2424
use async_trait::async_trait;
25+
use aws_config::stalled_stream_protection::StalledStreamProtectionConfig;
2526
use aws_credential_types::provider::SharedCredentialsProvider;
2627
use aws_sdk_s3::Client as S3Client;
2728
use aws_sdk_s3::config::{
@@ -145,7 +146,11 @@ pub async fn create_s3_client(s3_storage_config: &S3StorageConfig) -> S3Client {
145146
s3_config.set_http_client(aws_config.http_client());
146147
s3_config.set_retry_config(aws_config.retry_config().cloned());
147148
s3_config.set_sleep_impl(aws_config.sleep_impl());
148-
s3_config.set_stalled_stream_protection(aws_config.stalled_stream_protection());
149+
let stalled_stream_protection = StalledStreamProtectionConfig::enabled()
150+
.upload_enabled(!s3_storage_config.disable_stalled_stream_protection_upload)
151+
.download_enabled(!s3_storage_config.disable_stalled_stream_protection_download)
152+
.build();
153+
s3_config.set_stalled_stream_protection(Some(stalled_stream_protection));
149154
s3_config.set_timeout_config(aws_config.timeout_config().cloned());
150155

151156
if s3_storage_config.disable_checksums {

0 commit comments

Comments
 (0)