mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-20 03:22:18 +00:00
fix: preserve data on self metadata copy (#2819)
Co-authored-by: cxymds <Cxymds@qq.com>
This commit is contained in:
@@ -2665,7 +2665,7 @@ impl DiskAPI for LocalDisk {
|
||||
|
||||
let mut xl_meta = FileMeta::load(buf.as_ref())?;
|
||||
|
||||
xl_meta.update_object_version(fi)?;
|
||||
xl_meta.update_object_version_with_opts(fi, opts.replace_user_metadata)?;
|
||||
|
||||
let wbuf = xl_meta.marshal_msg()?;
|
||||
|
||||
|
||||
@@ -559,6 +559,7 @@ pub struct CheckPartsResp {
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct UpdateMetadataOpts {
|
||||
pub no_persistence: bool,
|
||||
pub replace_user_metadata: bool,
|
||||
}
|
||||
|
||||
pub struct DiskLocation {
|
||||
@@ -914,9 +915,13 @@ mod tests {
|
||||
/// Test UpdateMetadataOpts structure
|
||||
#[test]
|
||||
fn test_update_metadata_opts() {
|
||||
let opts = UpdateMetadataOpts { no_persistence: true };
|
||||
let opts = UpdateMetadataOpts {
|
||||
no_persistence: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert!(opts.no_persistence);
|
||||
assert!(!opts.replace_user_metadata);
|
||||
}
|
||||
|
||||
/// Test DiskOption structure
|
||||
|
||||
Reference in New Issue
Block a user