]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: data sync: handle preconfition failed error
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 19 Nov 2019 22:44:25 +0000 (14:44 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:39 +0000 (10:20 -0800)
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 <yehuda@redhat.com>
src/rgw/rgw_data_sync.cc

index b1a6aeca3e314fcb3bc273ffa39537258d7a733e..93eb73265172ed672eb4af75818792e16660a832 100644 (file)
@@ -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);