]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: deleting objects inline in case bypass_gc is specified 44237/head
authorPritha Srivastava <prsrivas@redhat.com>
Tue, 7 Dec 2021 11:01:25 +0000 (16:31 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 7 Dec 2021 15:27:21 +0000 (20:57 +0530)
for bucket remove command.

fixes: https://tracker.ceph.com/issues/53512

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
src/rgw/rgw_rados.h
src/rgw/rgw_sal_rados.cc

index e59e0460e99513acc99f68b6dde7c05c300d0a0f..44e7b953bf17bc66ebc84f548ab595738d07d5ce 100644 (file)
@@ -482,6 +482,10 @@ public:
     return lc;
   }
 
+  RGWGC *get_gc() {
+    return gc;
+  }
+
   RGWRados& set_run_gc_thread(bool _use_gc_thread) {
     use_gc_thread = _use_gc_thread;
     return *this;
index 7c42b52472840f8d0b070d3966cb748367d4cee1..76b2399825da7b98d712a236488649e31c72fa02 100644 (file)
@@ -1985,15 +1985,20 @@ int RadosMultipartUpload::abort(const DoutPrefixProvider *dpp, CephContext *cct,
     }
   } while (truncated);
 
-  /* use upload id as tag and do it synchronously */
-  ret = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id());
-  if (ret < 0) {
-    ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl;
-    if (ret == -ENOENT) {
-      return -ERR_NO_SUCH_UPLOAD;
-    }
-    //Delete objects inline if send chain to gc fails
+  if (store->getRados()->get_gc() == nullptr) {
+    //Delete objects inline if gc hasn't been initialised (in case when bypass gc is specified)
     store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id());
+  } else {
+    /* use upload id as tag and do it synchronously */
+    ret = store->getRados()->send_chain_to_gc(chain, mp_obj.get_upload_id());
+    if (ret < 0) {
+      ldpp_dout(dpp, 5) << __func__ << ": gc->send_chain() returned " << ret << dendl;
+      if (ret == -ENOENT) {
+        return -ERR_NO_SUCH_UPLOAD;
+      }
+      //Delete objects inline if send chain to gc fails
+      store->getRados()->delete_objs_inline(dpp, chain, mp_obj.get_upload_id());
+    }
   }
 
   std::unique_ptr<rgw::sal::Object::DeleteOp> del_op = meta_obj->get_delete_op(obj_ctx);