]> 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>
Tue, 1 Feb 2022 23:59:40 +0000 (18:59 -0500)
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 f119d23e4f2ea84fa7fe2eb974c6821f221a00e2..a2f41becd3b0c144e5823d77ead95a5f702a3229 100644 (file)
@@ -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);