]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add sync_single_entry() helper function
authorCasey Bodley <cbodley@redhat.com>
Tue, 31 Mar 2020 13:23:01 +0000 (09:23 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 13 Apr 2020 15:06:46 +0000 (11:06 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_data_sync.cc

index ed75122ac595bfcb47ca9a8f125964635f166816..b66414f33c253402841b520469a949e69ad6154e 100644 (file)
@@ -1448,6 +1448,13 @@ class RGWDataSyncShardCR : public RGWCoroutine {
     return rgw_bucket_parse_bucket_key(sync_env->cct, key,
                                        &bs.bucket, &bs.shard_id);
   }
+  RGWCoroutine* sync_single_entry(const rgw_bucket_shard& src,
+                                  const std::string& key,
+                                  const std::string& marker,
+                                  ceph::real_time timestamp, bool retry) {
+    return new RGWDataSyncSingleEntryCR(sc, src, key, marker, timestamp,
+                                        &*marker_tracker, error_repo, retry, tn);
+  }
 public:
   RGWDataSyncShardCR(RGWDataSyncCtx *_sc,
                      rgw_pool& _pool,
@@ -1578,7 +1585,8 @@ public:
             tn->log(0, SSTR("ERROR: cannot start syncing " << iter->first << ". Duplicate entry?"));
           } else {
             // fetch remote and write locally
-            yield spawn(new RGWDataSyncSingleEntryCR(sc, source_bs, iter->first, iter->first, entry_timestamp, &*marker_tracker, error_repo, false, tn), false);
+            spawn(sync_single_entry(source_bs, iter->first, iter->first,
+                                    entry_timestamp, false), false);
           }
           sync_marker.marker = iter->first;
 
@@ -1668,7 +1676,8 @@ public:
             continue;
           }
           tn->log(20, SSTR("received async update notification: " << *modified_iter));
-          spawn(new RGWDataSyncSingleEntryCR(sc, source_bs, *modified_iter, string(), ceph::real_time{}, &*marker_tracker, nullptr, false, tn), false);
+          spawn(sync_single_entry(source_bs, *modified_iter, string(),
+                                  ceph::real_time{}, false), false);
         }
 
         if (error_retry_time <= ceph::coarse_real_clock::now()) {
@@ -1690,9 +1699,8 @@ public:
               continue;
             }
             tn->log(20, SSTR("handle error entry key=" << error_marker << " timestamp=" << entry_timestamp));
-            spawn(new RGWDataSyncSingleEntryCR(sc, source_bs, error_marker, error_marker,
-                                               entry_timestamp, nullptr /* no marker tracker */,
-                                               error_repo, true, tn), false);
+            spawn(sync_single_entry(source_bs, error_marker, "",
+                                    entry_timestamp, true), false);
           }
           if (!omapvals->more) {
             if (error_marker.empty() && error_entries.empty()) {
@@ -1740,9 +1748,8 @@ public:
           if (!marker_tracker->start(log_iter->log_id, 0, log_iter->log_timestamp)) {
             tn->log(0, SSTR("ERROR: cannot start syncing " << log_iter->log_id << ". Duplicate entry?"));
           } else {
-            spawn(new RGWDataSyncSingleEntryCR(sc, source_bs, log_iter->entry.key, log_iter->log_id,
-                                               log_iter->log_timestamp, &*marker_tracker,
-                                               error_repo, false, tn), false);
+            spawn(sync_single_entry(source_bs, log_iter->entry.key, log_iter->log_id,
+                                    log_iter->log_timestamp, false), false);
           }
           while ((int)num_spawned() > spawn_window) {
             set_status() << "num_spawned() > spawn_window";