From 33a95da1aebdc4753ecb7f9668c68f6baea2784d Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 19 Nov 2019 14:44:25 -0800 Subject: [PATCH] rgw: data sync: handle preconfition failed error Handle precondition failed error. This would happen in case we cannot sync the object due to either newer local changes, or if the policy doesn't allow syncing the specific object. Handle this as success, but log a message. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_data_sync.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index b1a6aeca3e3..93eb7326517 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -3143,9 +3143,6 @@ public: tn->log(10, SSTR("removing obj: " << sc->source_zone << "/" << bs.bucket << "/" << key << "[" << versioned_epoch.value_or(0) << "]")); call(data_sync_module->remove_object(sc, sync_pipe, key, timestamp, versioned, versioned_epoch.value_or(0), &zones_trace)); // our copy of the object is more recent, continue as if it succeeded - if (retcode == -ERR_PRECONDITION_FAILED) { - retcode = 0; - } } else if (op == CLS_RGW_OP_LINK_OLH_DM) { set_status("creating delete marker"); tn->log(10, SSTR("creating delete marker: obj: " << sc->source_zone << "/" << bs.bucket << "/" << key << "[" << versioned_epoch.value_or(0) << "]")); @@ -3153,6 +3150,11 @@ public: } tn->set_resource_name(SSTR(bucket_str_noinstance(bs.bucket) << "/" << key)); } + if (retcode == -ERR_PRECONDITION_FAILED) { + set_status("Skipping object sync: precondition failed (object contains newer change or policy doesn't allow sync)"); + tn->log(0, "Skipping object sync: precondition failed (object contains newer change or policy doesn't allow sync)"); + retcode = 0; + } } while (marker_tracker->need_retry(key)); { tn->unset_flag(RGW_SNS_FLAG_ACTIVE); -- 2.39.5