]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/reshard: use cls_rgw_bi_put_entries() when replaying the reshard log
authorCasey Bodley <cbodley@redhat.com>
Tue, 3 Sep 2024 21:47:35 +0000 (17:47 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 5 Sep 2024 17:23:41 +0000 (13:23 -0400)
use cls_rgw_bi_put_entries() in BucketReshardShard::flush() to avoid
blocking on the extra call to bi_get_vals()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_reshard.cc

index d30a402f7061efe95fe6f8ff0df7a04439fb01d9..23a7f5f02addfb44ab7e3abbfd3122e2423b1186 100644 (file)
@@ -244,35 +244,11 @@ public:
 
     librados::ObjectWriteOperation op;
     if (process_log) {
-      map<RGWObjCategory, rgw_bucket_category_stats> dec_stats;
-      list<rgw_cls_bi_entry> dec_entries;
-      set<string> dec_entry_names_wanted;
-      for (auto& entry : entries) {
-        store->getRados()->bi_put(op, bs, entry, null_yield);
-        dec_entry_names_wanted.emplace(entry.idx);
-      }
-
-      // getting the index entry in target shard
-      int ret = store->getRados()->bi_get_vals(bs, dec_entry_names_wanted, &dec_entries, null_yield);
-      if(ret < 0) {
-        derr << "ERROR: bi_get_vals(): " << cpp_strerror(-ret) << dendl;
-        return ret;
-      }
-
-      for (auto& dec_entry : dec_entries) {
-        cls_rgw_obj_key cls_key;
-        RGWObjCategory category;
-        rgw_bucket_category_stats accounted_stats;
-        bool account = dec_entry.get_info(&cls_key, &category, &accounted_stats);
-        if (account) {
-          auto& dest = dec_stats[category];
-          dest.total_size += accounted_stats.total_size;
-          dest.total_size_rounded += accounted_stats.total_size_rounded;
-          dest.num_entries += accounted_stats.num_entries;
-          dest.actual_size += accounted_stats.actual_size;
-        }
-      }
-      cls_rgw_bucket_update_stats(op, false, stats, &dec_stats);
+      // write the entries in bulk and update the stats. since we may have
+      // already written some of these entries during the InLogrecord stage,
+      // check for existing entries and decrement their stats first
+      const bool check_existing = true;
+      cls_rgw_bi_put_entries(op, std::move(entries), check_existing);
     } else {
       for (auto& entry : entries) {
         store->getRados()->bi_put(op, bs, entry, null_yield);