]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/cloud-restore: Handle "null" instance non-current objects
authorSoumya Koduri <skoduri@redhat.com>
Tue, 4 Mar 2025 17:36:26 +0000 (23:06 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Fri, 14 Mar 2025 11:08:23 +0000 (16:38 +0530)
During restore, if the object instance is "null", clear it while updating
bi entry.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_sal_rados.cc

index 4cfd3f3590495cbde093c5c77923eaf20fc5abe0..a83abe07460c71fcf2b07bb5e12159238f8067a6 100644 (file)
@@ -5266,8 +5266,16 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
   auto aio = rgw::make_throttle(cct->_conf->rgw_put_obj_min_window_size, y);
   using namespace rgw::putobj;
   jspan_context no_trace{false, false};
+
+  // bi expects empty instance for the entries created when
+  // bucket versioning is not enabled or suspended.
+  rgw_obj dest_obj_bi = dest_obj;
+  if (dest_obj_bi.key.instance == "null") {
+    dest_obj_bi.key.instance.clear();
+  }
+
   rgw::putobj::AtomicObjectProcessor processor(aio.get(), this, dest_bucket_info, nullptr,
-                                  owner, obj_ctx, dest_obj, olh_epoch, tag, dpp, y, no_trace);
+                                  owner, obj_ctx, dest_obj_bi, olh_epoch, tag, dpp, y, no_trace);
  
   void (*progress_cb)(off_t, void *) = NULL;
   void *progress_data = NULL;
index 387a3febaeb5ea5eee275858a7717b7a005e958e..f27e4c895a0a175bbc5cc0289396bfdd8ff912ed 100644 (file)
@@ -3081,11 +3081,21 @@ int RadosObject::set_cloud_restore_status(const DoutPrefixProvider* dpp,
  */
 int RadosObject::handle_obj_expiry(const DoutPrefixProvider* dpp, optional_yield y) {
   int ret = 0;
+
+  /* once bucket versioning is enabled, the non-current entries with
+   * instance empty should have instance set to "null" to be able
+   * to correctly read its olh version entry.
+   */
+  rgw_obj_key& obj_key = get_key();
+  rgw::sal::Bucket* bucket = get_bucket();
+
+  if (obj_key.instance.empty() && bucket->versioned()) {
+    obj_key.instance = "null";
+  }
+
   real_time read_mtime;
   std::unique_ptr<rgw::sal::Object::ReadOp> read_op(get_read_op());
   read_op->params.lastmod = &read_mtime;
-  ldpp_dout(dpp, 20) << "Entering handle_obj_expiry Obj:" << get_key() << dendl;
-
   ret = read_op->prepare(y, dpp);
   if (ret < 0) {
     ldpp_dout(dpp, -1) << "handle_obj_expiry Obj:" << get_key() << 
@@ -3093,6 +3103,10 @@ int RadosObject::handle_obj_expiry(const DoutPrefixProvider* dpp, optional_yield
     return ret;
   }
 
+  if (obj_key.instance == "null") {
+    obj_key.instance.clear();
+  }
+
   set_atomic();
   map<string, bufferlist> attrs = get_attrs();
   RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rados_ctx, get_obj());