mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-01 09:48:20 +00:00
fix: persist replication status and timestamp after replicate_object (#1747)
Signed-off-by: houseme <housemecn@gmail.com> Co-authored-by: houseme <housemecn@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1680,8 +1680,17 @@ pub async fn replicate_object<S: StorageAPI>(roi: ReplicateObjectInfo, storage:
|
|||||||
let mut object_info = roi.to_object_info();
|
let mut object_info = roi.to_object_info();
|
||||||
|
|
||||||
if roi.replication_status_internal != new_replication_internal || rinfos.replication_resynced() {
|
if roi.replication_status_internal != new_replication_internal || rinfos.replication_resynced() {
|
||||||
|
let mut eval_metadata = HashMap::new();
|
||||||
|
if let Some(ref s) = new_replication_internal {
|
||||||
|
eval_metadata.insert(format!("{RESERVED_METADATA_PREFIX_LOWER}replication-status"), s.clone());
|
||||||
|
}
|
||||||
|
eval_metadata.insert(
|
||||||
|
format!("{RESERVED_METADATA_PREFIX_LOWER}replication-timestamp"),
|
||||||
|
OffsetDateTime::now_utc().format(&Rfc3339).unwrap_or_default(),
|
||||||
|
);
|
||||||
let popts = ObjectOptions {
|
let popts = ObjectOptions {
|
||||||
version_id: roi.version_id.map(|v| v.to_string()),
|
version_id: roi.version_id.map(|v| v.to_string()),
|
||||||
|
eval_metadata: Some(eval_metadata),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1889,6 +1898,10 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
|||||||
} {
|
} {
|
||||||
rinfo.replication_status = ReplicationStatusType::Failed;
|
rinfo.replication_status = ReplicationStatusType::Failed;
|
||||||
rinfo.error = Some(err.to_string());
|
rinfo.error = Some(err.to_string());
|
||||||
|
warn!(
|
||||||
|
"replication put_object failed src_bucket={} dest_bucket={} object={} err={:?}",
|
||||||
|
bucket, tgt_client.bucket, object, err
|
||||||
|
);
|
||||||
|
|
||||||
// TODO: check offline
|
// TODO: check offline
|
||||||
return rinfo;
|
return rinfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user