mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 23:26:53 +00:00
fix(replication): propagate metadata changes (#5635)
Preserve metadata replication operations in the durable MRF and route tagging, retention, and legal-hold updates through the existing full-object replication transport. Keep ACL propagation outside the contract because the current object model has no durable object ACL state. Refs #1616
This commit is contained in:
@@ -164,6 +164,7 @@ mod tests {
|
||||
replication_etags_match, target_is_newer_than_source_null_version,
|
||||
};
|
||||
use crate::filemeta::{ReplicationAction, ReplicationType};
|
||||
use crate::http::AMZ_OBJECT_LOCK_MODE;
|
||||
use std::collections::HashMap;
|
||||
use time::{Duration, OffsetDateTime};
|
||||
|
||||
@@ -267,4 +268,27 @@ mod tests {
|
||||
ReplicationAction::Metadata
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replication_action_detects_tags_and_object_lock_metadata_differences() {
|
||||
let mut source_metadata = HashMap::new();
|
||||
source_metadata.insert(AMZ_OBJECT_LOCK_MODE.to_string(), "GOVERNANCE".to_string());
|
||||
let source = ReplicationSourceObject {
|
||||
user_tags: "a=1&b=2",
|
||||
user_defined: &source_metadata,
|
||||
..source_object(&source_metadata)
|
||||
};
|
||||
|
||||
let target_metadata = HashMap::new();
|
||||
let target = ReplicationTargetObject {
|
||||
tag_count: 1,
|
||||
metadata: Some(&target_metadata),
|
||||
..target_object(&target_metadata)
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
replication_action_for_target(&source, &target, ReplicationType::Metadata),
|
||||
ReplicationAction::Metadata
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user