]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/multisite: handle the 'deleted' index log addition in RGWBucketInstanceMetadataHa...
authorShilpa Jagannath <smanjara@redhat.com>
Tue, 7 Nov 2023 04:06:27 +0000 (23:06 -0500)
committerShilpa Jagannath <smanjara@redhat.com>
Fri, 4 Apr 2025 17:16:53 +0000 (13:16 -0400)
create an async cr for removing bucket instance info in bilog trimming logic

Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
src/rgw/driver/rados/rgw_cr_rados.cc
src/rgw/driver/rados/rgw_cr_rados.h
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_trim_bilog.cc

index f77965b1c8c497c0652df62ea8e2f8d9953d3ba9..332006c02fd45f1706230ab5ba21027da52cab26 100644 (file)
@@ -674,6 +674,18 @@ int RGWAsyncPutBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp)
   return 0;
 }
 
+int RGWAsyncRemoveBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp)
+{
+  auto r = store->ctl()->bucket->remove_bucket_instance_info(bucket, bucket_info,
+                                                      null_yield, dpp);
+  if (r < 0) {
+    ldpp_dout(dpp, 0) << "ERROR: failed to remove bucket instance info for "
+                     << bucket_info.bucket << dendl;
+    return r;
+  }
+  return 0;
+}
+
 RGWRadosBILogTrimCR::RGWRadosBILogTrimCR(
   const DoutPrefixProvider *dpp,
   rgw::sal::RadosStore* store,
index 6f243f08cd1ab49e56aa612bf9b1383d2f0aa6a3..09b364a7e17bfe8eaf00132f25b10f2678c5e2a2 100644 (file)
@@ -1026,6 +1026,66 @@ public:
   }
 };
 
+class RGWAsyncRemoveBucketInstanceInfo : public RGWAsyncRadosRequest {
+  rgw::sal::RadosStore* store;
+  rgw_bucket bucket;
+  RGWBucketInfo& bucket_info;
+  const DoutPrefixProvider *dpp;
+
+protected:
+  int _send_request(const DoutPrefixProvider *dpp) override;
+public:
+  RGWAsyncRemoveBucketInstanceInfo(RGWCoroutine* caller,
+                               RGWAioCompletionNotifier* cn,
+                                rgw::sal::RadosStore* store,
+        const rgw_bucket& bucket,
+                               RGWBucketInfo& bucket_info,
+                               const DoutPrefixProvider* dpp)
+    : RGWAsyncRadosRequest(caller, cn), store(store), bucket(bucket), bucket_info(bucket_info),
+      dpp(dpp) {}
+};
+
+class RGWRemoveBucketInstanceInfoCR : public RGWSimpleCoroutine {
+  RGWAsyncRadosProcessor *async_rados;
+  rgw::sal::RadosStore* store;
+  rgw_bucket bucket;
+  RGWBucketInfo& bucket_info;
+  const DoutPrefixProvider *dpp;
+
+  RGWAsyncRemoveBucketInstanceInfo* req = nullptr;
+
+public:
+  // rgw_bucket constructor
+  RGWRemoveBucketInstanceInfoCR(RGWAsyncRadosProcessor *async_rados,
+                            rgw::sal::RadosStore* store,
+           const rgw_bucket& bucket,
+                            RGWBucketInfo& bucket_info,
+                            std::map<std::string, ceph::bufferlist>* attrs,
+           const DoutPrefixProvider *dpp)
+    : RGWSimpleCoroutine(store->ctx()), async_rados(async_rados), store(store),
+      bucket(bucket), bucket_info(bucket_info), dpp(dpp) {}
+  ~RGWRemoveBucketInstanceInfoCR() override {
+    request_cleanup();
+  }
+  void request_cleanup() override {
+    if (req) {
+      req->finish();
+      req = nullptr;
+    }
+  }
+
+  int send_request(const DoutPrefixProvider *dpp) override {
+    req = new RGWAsyncRemoveBucketInstanceInfo(this,
+                                           stack->create_completion_notifier(),
+                                           store, bucket, bucket_info, dpp);
+    async_rados->queue(req);
+    return 0;
+  }
+  int request_complete() override {
+    return req->get_ret_status();
+  }
+};
+
 class RGWRadosBILogTrimCR : public RGWSimpleCoroutine {
   const RGWBucketInfo& bucket_info;
   int shard_id;
index 109dde79603be8f54a98eb81f3226d6cfecef509..eb93d7f37e8b7f892be9f0caab2b5df61b36fedc 100644 (file)
@@ -5614,10 +5614,17 @@ int RGWRados::delete_bucket(RGWBucketInfo& bucket_info, RGWObjVersionTracker& ob
                                       cct->_conf->rgw_bucket_index_max_aio)();
   } else {
     bucket_info.deleted = true;
+    ldpp_dout(dpp, 0) << "setting deleted to: " << bucket_info.deleted << dendl;
     map<string, bufferlist> attrs;
-    r = put_bucket_instance_info(bucket_info, false, real_time(), &attrs, dpp, y);
+
+    r = ctl.bucket->store_bucket_instance_info(bucket, bucket_info, y, dpp, RGWBucketCtl::BucketInstance::PutParams()
+                                                                    .set_exclusive(false)
+                                                                    .set_mtime(real_time())
+                                                                    .set_attrs(&attrs)
+                                                                    .set_orig_info(&bucket_info));
     if (r < 0) {
-      ldpp_dout(dpp, 0) << "WARNING: put_bucket_info on bucket=" << bucket_info.bucket.name << " returned err=" << r << dendl;
+      ldpp_dout(dpp, 0) << "ERROR: failed to store bucket instance info for bucket=" << bucket.name << " ret=" << r << dendl;
+      return r;
     }
   }
 
index d2f86abe8b9297fb5d72d86cdb6a6a75051b1c4c..8c528a8b7343efdbd14f688b21c2141359f7b774 100644 (file)
@@ -762,7 +762,10 @@ int BucketTrimInstanceCR::operate(const DoutPrefixProvider *dpp)
 
   //remove bucket instance metadata
   if (clean_info->first.layout.logs.front().layout.type == rgw::BucketLogType::Deleted) {
-  retcode = store->ctl()->bucket->remove_bucket_instance_info(bucket, clean_info->first, null_yield, dpp);
+    yield call(new RGWRemoveBucketInstanceInfoCR(
+      store->svc()->rados->get_async_processor(),
+      store, clean_info->first.bucket,
+      clean_info->first, nullptr, dpp));
     if (retcode < 0) {
       ldpp_dout(dpp, 0) << "failed to remove instance bucket info: "
                         << cpp_strerror(retcode) << dendl;