]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: update indexless bucket check for bucket stats
authorJ. Eric Ivancich <ivancich@redhat.com>
Mon, 24 Jan 2022 21:10:57 +0000 (16:10 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 28 Apr 2022 18:00:55 +0000 (14:00 -0400)
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 <ivancich@redhat.com>
src/rgw/rgw_bucket.cc

index 8f194840dea3a30e8c3156d3269898628b922f6b..57f8b88c7d7ed692e0b154ad484152d45a48d59a 100644 (file)
@@ -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);