fix(replication): avoid re-replication loop in Active-Active replication (#1751)

Co-authored-by: loverustfs <hello@rustfs.com>
This commit is contained in:
LeonWang0735
2026-02-09 14:11:30 +08:00
committed by GitHub
parent ff8c1c782a
commit f4e9ef2edc
5 changed files with 113 additions and 13 deletions
+10 -1
View File
@@ -64,6 +64,8 @@ use uuid::Uuid;
const DEFAULT_HEALTH_CHECK_DURATION: Duration = Duration::from_secs(5);
const DEFAULT_HEALTH_CHECK_RELOAD_DURATION: Duration = Duration::from_secs(30 * 60);
const REPLICATION_REQUEST_TRUE: HeaderValue = HeaderValue::from_static("true");
pub static GLOBAL_BUCKET_TARGET_SYS: OnceLock<BucketTargetSys> = OnceLock::new();
#[derive(Debug, Clone)]
@@ -999,10 +1001,14 @@ impl PutObjectOptions {
if self.internal.source_mtime.unix_timestamp() != 0 {
header.insert(
RUSTFS_BUCKET_SOURCE_MTIME,
HeaderValue::from_str(&self.internal.source_mtime.unix_timestamp().to_string()).expect("err"),
HeaderValue::from_str(&self.internal.source_mtime.format(&Rfc3339).unwrap_or_default()).expect("err"),
);
}
if self.internal.replication_request {
header.insert(RUSTFS_BUCKET_REPLICATION_REQUEST, REPLICATION_REQUEST_TRUE);
}
header
}
@@ -1211,6 +1217,9 @@ impl TargetClient {
{
headers.insert(RUSTFS_BUCKET_SOURCE_VERSION_ID, header_value);
}
if opts.internal.replication_request {
headers.insert(RUSTFS_BUCKET_REPLICATION_REQUEST, REPLICATION_REQUEST_TRUE);
}
match self
.client