From 0ccf50fc9df95bf2b125e4b3cb1b641aef8c23b5 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 9 Jan 2018 15:18:55 -0500 Subject: [PATCH] rgw: RGWRadosGetOmapKeysCR uses omap_get_keys2 Signed-off-by: Casey Bodley --- src/rgw/rgw_cr_rados.cc | 4 ++-- src/rgw/rgw_cr_rados.h | 4 ++-- src/rgw/rgw_data_sync.cc | 22 +++++++++++----------- src/rgw/rgw_sync.cc | 18 +++++++++--------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 32325528baa..79d3cdfa800 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -249,7 +249,7 @@ int RGWRadosSetOmapKeysCR::request_complete() RGWRadosGetOmapKeysCR::RGWRadosGetOmapKeysCR(RGWRados *_store, const rgw_raw_obj& _obj, const string& _marker, - map *_entries, int _max_entries) : RGWSimpleCoroutine(_store->ctx()), + std::set *_entries, int _max_entries) : RGWSimpleCoroutine(_store->ctx()), store(_store), marker(_marker), entries(_entries), max_entries(_max_entries), @@ -268,7 +268,7 @@ int RGWRadosGetOmapKeysCR::send_request() { set_status() << "send request"; librados::ObjectReadOperation op; - op.omap_get_vals2(marker, max_entries, entries, nullptr, nullptr); + op.omap_get_keys2(marker, max_entries, entries, nullptr, nullptr); cn = stack->create_completion_notifier(); return ref.ioctx.aio_operate(ref.oid, cn->completion(), &op, NULL); diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 85d26632ab0..f4b9ea5fcdf 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -410,7 +410,7 @@ class RGWRadosGetOmapKeysCR : public RGWSimpleCoroutine { RGWRados *store; string marker; - map *entries; + std::set *entries; int max_entries; rgw_rados_ref ref; @@ -423,7 +423,7 @@ public: RGWRadosGetOmapKeysCR(RGWRados *_store, const rgw_raw_obj& _obj, const string& _marker, - map *_entries, int _max_entries); + std::set *_entries, int _max_entries); int send_request() override; int request_complete() override; diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 0b2e5c28827..330804c9841 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -1093,8 +1093,8 @@ class RGWDataSyncShardCR : public RGWCoroutine { uint32_t shard_id; rgw_data_sync_marker sync_marker; - map entries; - map::iterator iter; + std::set entries; + std::set::iterator iter; string oid; @@ -1135,7 +1135,7 @@ class RGWDataSyncShardCR : public RGWCoroutine { string error_oid; RGWOmapAppend *error_repo; - map error_entries; + std::set error_entries; string error_marker; int max_error_entries; @@ -1267,20 +1267,20 @@ public: tn->log(20, SSTR("retrieved " << entries.size() << " entries to sync")); iter = entries.begin(); for (; iter != entries.end(); ++iter) { - tn->log(20, SSTR("full sync: " << iter->first)); + tn->log(20, SSTR("full sync: " << *iter)); total_entries++; - if (!marker_tracker->start(iter->first, total_entries, real_time())) { - tn->log(0, SSTR("ERROR: cannot start syncing " << iter->first << ". Duplicate entry?")); + if (!marker_tracker->start(*iter, total_entries, real_time())) { + tn->log(0, SSTR("ERROR: cannot start syncing " << *iter << ". Duplicate entry?")); } else { // fetch remote and write locally - yield spawn(new RGWDataSyncSingleEntryCR(sync_env, iter->first, iter->first, marker_tracker, error_repo, false, tn), false); + yield spawn(new RGWDataSyncSingleEntryCR(sync_env, *iter, *iter, marker_tracker, error_repo, false, tn), false); if (retcode < 0) { lease_cr->go_down(); drain_all(); return set_cr_error(retcode); } } - sync_marker.marker = iter->first; + sync_marker.marker = *iter; } } while ((int)entries.size() == max_entries); @@ -1353,9 +1353,9 @@ public: tn->log(20, SSTR("read error repo, got " << error_entries.size() << " entries")); iter = error_entries.begin(); for (; iter != error_entries.end(); ++iter) { - tn->log(20, SSTR("handle error entry: " << iter->first)); - spawn(new RGWDataSyncSingleEntryCR(sync_env, iter->first, iter->first, nullptr /* no marker tracker */, error_repo, true, tn), false); - error_marker = iter->first; + error_marker = *iter; + tn->log(20, SSTR("handle error entry: " << error_marker)); + spawn(new RGWDataSyncSingleEntryCR(sync_env, error_marker, error_marker, nullptr /* no marker tracker */, error_repo, true, tn), false); } if ((int)error_entries.size() != max_error_entries) { if (error_marker.empty() && error_entries.empty()) { diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index e2dcfa46724..855ad682bf7 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -1360,8 +1360,8 @@ class RGWMetaSyncShardCR : public RGWCoroutine { string max_marker; const std::string& period_marker; //< max marker stored in next period - map entries; - map::iterator iter; + std::set entries; + std::set::iterator iter; string oid; @@ -1562,20 +1562,20 @@ public: } iter = entries.begin(); for (; iter != entries.end(); ++iter) { - tn->log(20, SSTR("full sync: " << iter->first)); + marker = *iter; + tn->log(20, SSTR("full sync: " << marker)); total_entries++; - if (!marker_tracker->start(iter->first, total_entries, real_time())) { - tn->log(0, SSTR("ERROR: cannot start syncing " << iter->first << ". Duplicate entry?")); + if (!marker_tracker->start(marker, total_entries, real_time())) { + tn->log(0, SSTR("ERROR: cannot start syncing " << marker << ". Duplicate entry?")); } else { // fetch remote and write locally yield { - RGWCoroutinesStack *stack = spawn(new RGWMetaSyncSingleEntryCR(sync_env, iter->first, iter->first, MDLOG_STATUS_COMPLETE, marker_tracker, tn), false); + RGWCoroutinesStack *stack = spawn(new RGWMetaSyncSingleEntryCR(sync_env, marker, marker, MDLOG_STATUS_COMPLETE, marker_tracker, tn), false); // stack_to_pos holds a reference to the stack - stack_to_pos[stack] = iter->first; - pos_to_prev[iter->first] = marker; + stack_to_pos[stack] = marker; + pos_to_prev[marker] = marker; } } - marker = iter->first; } collect_children(); } while ((int)entries.size() == max_entries && can_adjust_marker); -- 2.39.5