From: Abhishek Lekshmanan Date: Wed, 13 Feb 2019 12:32:43 +0000 (+0100) Subject: rgw: orphan: flush bucket index entries only after map is full X-Git-Tag: v14.2.1~30^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dc4205a65c216424bab735f139e7fe597760f5ea;p=ceph.git rgw: orphan: flush bucket index entries only after map is full We otherwise may flush more regularly while we don't have enough entries in the map Signed-off-by: Abhishek Lekshmanan (cherry picked from commit e9a406c9b036e4c3190077d57fc51d6ea3762475) --- diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index e3f316411235..a91be60363fb 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -191,9 +191,10 @@ int RGWOrphanSearch::init(const string& job_name, RGWOrphanSearchInfo *info) { return r; } - constexpr auto MAX_LIST_OBJS_ENTRIES = 100; + constexpr int64_t MAX_LIST_OBJS_ENTRIES=100; + max_list_bucket_entries = std::max(store->ctx()->_conf->rgw_list_bucket_min_readahead, - MAX_LIST_OBJS_ENTRIES) + MAX_LIST_OBJS_ENTRIES); RGWOrphanSearchState state; r = orphan_store.read_job(job_name, state); @@ -502,8 +503,6 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ deque stat_ops; - int count = 0; - do { vector result; @@ -544,13 +543,12 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ } } } - if (++count >= COUNT_BEFORE_FLUSH) { + if (oids.size() >= COUNT_BEFORE_FLUSH) { ret = log_oids(linked_objs_index, oids); if (ret < 0) { cerr << __func__ << ": ERROR: log_oids() returned ret=" << ret << std::endl; return ret; } - count = 0; oids.clear(); } }