From: J. Eric Ivancich Date: Mon, 24 Jan 2022 21:10:57 +0000 (-0500) Subject: rgw: update indexless bucket check for bucket stats X-Git-Tag: v18.0.0~787^2~53 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=194b0de182e5120b7e6f646bb279cd7831e9749f;p=ceph.git rgw: update indexless bucket check for bucket stats The code for bucket stats was recently updated to check for an indexless bucket before proceeding. The interface on RGWBucketInfo was recently expanded to support these types of checks, so it is now used. Signed-off-by: J. Eric Ivancich --- diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 8f231c9780da..e2966c0ad187 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1044,23 +1044,13 @@ static int bucket_stats(rgw::sal::Store* store, return ret; } - if (bucket->get_info().layout.current_index.layout.type == - rgw::BucketIndexType::Indexless) { + if (bucket->get_info().is_indexless()) { cerr << "error, indexless buckets do not maintain stats; bucket=" << bucket->get_name() << std::endl; return -EINVAL; } - if (bucket->get_info().layout.logs.empty()) { - // this check may be redundant with the previous check of - // layout.type; calling back() on an empty vector produces - // undefined behavior - cerr << "error, layout log list is empty; bucket=" << bucket->get_name() << - std::endl; - return -EINVAL; - } - const auto& latest_log = bucket->get_info().layout.logs.back(); - const auto& index = log_to_index_layout(latest_log); + const auto& index = bucket->get_info().get_current_index(); std::string bucket_ver, master_ver; std::string max_marker; ret = bucket->read_stats(dpp, index, RGW_NO_SHARD, &bucket_ver, &master_ver, stats, &max_marker);