From c003e5f33b1ddb72e040e7bfbb37cb89b583e507 Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Wed, 13 Feb 2019 13:15:02 +0100 Subject: [PATCH] rgw: orphans tool: align with rgw list bucket min readahead At rgw::rados layer we read upto `min readahead` entries anyway and then pass on only the requested amount to the caller. Since this translates down to a cls call requesting a 1000 omap keys by default, it makes sense not to waste the entries, and process them Signed-off-by: Abhishek Lekshmanan (cherry picked from commit 4c033bf0fd0429378ac350eecd78530cc1c11b84) --- src/rgw/rgw_orphan.cc | 8 ++++++-- src/rgw/rgw_orphan.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index 930bbb0489586..e3f3164112350 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -191,6 +191,10 @@ int RGWOrphanSearch::init(const string& job_name, RGWOrphanSearchInfo *info) { return r; } + constexpr auto MAX_LIST_OBJS_ENTRIES = 100; + max_list_bucket_entries = std::max(store->ctx()->_conf->rgw_list_bucket_min_readahead, + MAX_LIST_OBJS_ENTRIES) + RGWOrphanSearchState state; r = orphan_store.read_job(job_name, state); if (r < 0 && r != -ENOENT) { @@ -503,8 +507,8 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const string& bucket_instance_ do { vector result; -#define MAX_LIST_OBJS_ENTRIES 100 - ret = list_op.list_objects(MAX_LIST_OBJS_ENTRIES, &result, NULL, &truncated); + ret = list_op.list_objects(max_list_bucket_entries, + &result, nullptr, &truncated); if (ret < 0) { cerr << "ERROR: store->list_objects(): " << cpp_strerror(-ret) << std::endl; return -ret; diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index d8076faec9a0d..d7fbdfa62958b 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -163,6 +163,7 @@ class RGWOrphanSearch { uint16_t max_concurrent_ios; uint64_t stale_secs; + uint64_t max_list_obj_entries; struct log_iter_info { string oid; -- 2.39.5