mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-06 21:33:14 +00:00
fix(site-replication): site replication flag issue and resolved the replication storm (#4120)
* fix(site-replication): Add Docker Compose setup for site replication testing - Fixed the site replication flag issue and resolved the replication storm. - Introduced a new directory for site replication tests with Docker Compose. - Created `docker-compose.yml` to define three RustFS sites and a setup container. - Added `README.md` to document the purpose, usage, and test flow of the replication setup. - Implemented `run-object-flow-check.sh` script to verify object replication across sites. - Configured health checks and volume permissions for the RustFS containers. - Enabled customization of access keys, bucket names, and other parameters via environment variables. * fix * fix
This commit is contained in:
@@ -109,6 +109,14 @@ impl ObjectOptions {
|
||||
}
|
||||
|
||||
pub fn put_replication_state(&self) -> ReplicationState {
|
||||
if self
|
||||
.delete_replication
|
||||
.as_ref()
|
||||
.is_some_and(|state| !state.replica_status.is_empty())
|
||||
{
|
||||
return self.delete_replication.clone().unwrap_or_default();
|
||||
}
|
||||
|
||||
let rs = match rustfs_utils::http::get_str(&self.user_defined, rustfs_utils::http::SUFFIX_REPLICATION_STATUS) {
|
||||
Some(v) => v,
|
||||
None => return ReplicationState::default(),
|
||||
@@ -797,6 +805,21 @@ mod tests {
|
||||
assert_eq!(versions[0].version_id, Some(last_version));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn put_replication_state_preserves_replica_status() {
|
||||
let opts = ObjectOptions {
|
||||
delete_replication: Some(ReplicationState {
|
||||
replica_status: ReplicationStatusType::Replica,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let state = opts.put_replication_state();
|
||||
|
||||
assert_eq!(state.composite_replication_status(), ReplicationStatusType::Replica);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn versions_after_marker_handles_uuid_version_marker() {
|
||||
let first_version = Uuid::parse_str("11111111-2222-3333-4444-555555555555").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user