Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gun9niR committed Feb 15, 2023
1 parent 209df1c commit 72f6c35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion risedev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ profile:
config-path: src/config/ci.toml
steps:
- use: minio
- use: etcd
unsafe-no-fsync: true
- use: meta-node
- use: compute-node
Expand Down
30 changes: 15 additions & 15 deletions src/object_store/src/object/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,7 @@ impl S3ObjectStore {
.load()
.await;
let client = Client::new(&sdk_config);
Self::configure_bucket_lifecycle(&client, &bucket)
.await
.unwrap();
Self::configure_bucket_lifecycle(&client, &bucket).await;

Self {
client,
Expand Down Expand Up @@ -566,9 +564,7 @@ impl S3ObjectStore {
.await;

let client = Client::new(&sdk_config);
Self::configure_bucket_lifecycle(&client, bucket.as_str())
.await
.unwrap();
Self::configure_bucket_lifecycle(&client, bucket.as_str()).await;

// check whether use batch delete
let charset = "1234567890";
Expand Down Expand Up @@ -688,7 +684,7 @@ impl S3ObjectStore {
/// - <https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpu-abort-incomplete-mpu-lifecycle-config.html>
/// - MinIO
/// - <https://github.com/minio/minio/issues/15681#issuecomment-1245126561>
async fn configure_bucket_lifecycle(client: &Client, bucket: &str) -> ObjectResult<()> {
async fn configure_bucket_lifecycle(client: &Client, bucket: &str) {
// Check if lifecycle is already configured to avoid overriding existing configuration.
let mut configured_rules = vec![];
let get_config_result = client
Expand Down Expand Up @@ -726,19 +722,23 @@ impl S3ObjectStore {
let bucket_lifecycle_config = BucketLifecycleConfiguration::builder()
.rules(bucket_lifecycle_rule)
.build();
client
if client
.put_bucket_lifecycle_configuration()
.bucket(bucket)
.lifecycle_configuration(bucket_lifecycle_config)
.send()
.await?;
tracing::info!(
"S3 bucket {:?} is configured to automatically purge abandoned MultipartUploads after {} days",
bucket,
S3_INCOMPLETE_MULTIPART_UPLOAD_RETENTION_DAYS,
);
.await
.is_ok()
{
tracing::info!(
"S3 bucket {:?} is configured to automatically purge abandoned MultipartUploads after {} days",
bucket,
S3_INCOMPLETE_MULTIPART_UPLOAD_RETENTION_DAYS,
);
} else {
tracing::warn!("Failed to configure life cycle rule for S3 bucket: {:?}. It is recommended to configure it manually to avoid unnecessary storage cost.", bucket);
}
}
Ok(())
}
}

Expand Down

0 comments on commit 72f6c35

Please sign in to comment.