From da3d21fe868674631b6950d66cfa0b9159330b13 Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Mon, 24 Jan 2022 16:10:57 -0500 Subject: [PATCH] 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 --- src/rgw/rgw_bucket.cc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 8f194840dea3a..57f8b88c7d7ed 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1045,23 +1045,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); -- 2.39.5