mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-03 06:36:35 +00:00
fix(s3): report storage class in multipart upload listings (#9835)
* test(s3): check storage class on pending multipart uploads Check the listed class while the upload is still open so the existing retry and resume scenario covers the response that clients use to find their pending uploads. * fix(s3): report storage class in multipart upload listings Clients that require StorageClass cannot read a nonempty upload list when the field is missing. Carry the stored class from the metadata already read for the listing and apply the same default as ListParts.
This commit is contained in:
@@ -226,6 +226,18 @@ mod tests {
|
||||
.await?;
|
||||
|
||||
let resumed_client = env.create_s3_client();
|
||||
let pending = resumed_client
|
||||
.list_multipart_uploads()
|
||||
.bucket(bucket)
|
||||
.prefix(&key)
|
||||
.send()
|
||||
.await?;
|
||||
let upload = pending
|
||||
.uploads()
|
||||
.iter()
|
||||
.find(|upload| upload.key() == Some(key.as_str()) && upload.upload_id() == Some(upload_id))
|
||||
.ok_or("ListMultipartUploads omitted the pending upload")?;
|
||||
assert_eq!(upload.storage_class().map(StorageClass::as_str), Some(class_name));
|
||||
let before_retry = resumed_client
|
||||
.list_parts()
|
||||
.bucket(bucket)
|
||||
|
||||
@@ -2819,7 +2819,7 @@ impl SetDisks {
|
||||
};
|
||||
Ok(Some((file_info, object)))
|
||||
})();
|
||||
let (file_info, object) = match decoded {
|
||||
let (mut file_info, object) = match decoded {
|
||||
Ok(Some(decoded)) => decoded,
|
||||
Ok(None) => return Ok(None),
|
||||
// Deterministic damage (undecodable metadata that still
|
||||
@@ -2856,7 +2856,11 @@ impl SetDisks {
|
||||
object,
|
||||
upload_id: runtime_sources::deployment_upload_id(raw_upload_id),
|
||||
initiated,
|
||||
..Default::default()
|
||||
user_defined: file_info
|
||||
.metadata
|
||||
.remove_entry(metadata_keys::STORAGE_CLASS)
|
||||
.into_iter()
|
||||
.collect(),
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -20,6 +20,7 @@ use crate::app::dto_values;
|
||||
use crate::app::storage_api::multipart_usecase::contract::multipart::ListMultipartsInfo;
|
||||
pub(crate) use crate::app::storage_api::multipart_usecase::contract::multipart::ListPartsInfo;
|
||||
use crate::app::storage_api::multipart_usecase::contract::multipart::ListPartsOwner;
|
||||
use crate::app::storage_api::storage_class::effective_class;
|
||||
use rustfs_gateway_types::dto as gateway_dto;
|
||||
use rustfs_gateway_types::{BucketName, ObjectKey, RecordedUpload, UploadIdClaim, resolve_upload_async};
|
||||
use rustfs_s3_types::S3Result;
|
||||
@@ -247,6 +248,9 @@ fn list_multipart_uploads_output(
|
||||
key: Some(key),
|
||||
upload_id: Some(upload.upload_id),
|
||||
initiated: upload.initiated.map(dto_values::timestamp),
|
||||
storage_class: Some(gateway_dto::StorageClass::custom(
|
||||
effective_class(upload.user_defined.get(AMZ_STORAGE_CLASS).map(String::as_str), None).to_owned(),
|
||||
)),
|
||||
owner: Some(owner.clone()),
|
||||
initiator: Some(initiator.clone()),
|
||||
..Default::default()
|
||||
|
||||
Reference in New Issue
Block a user