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-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=421fd2de8e334158c3d48c136e37918027b01b54;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 f119d23e4f2ea..a2f41becd3b0c 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -1076,23 +1076,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);