]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: obj delete operation can use remove_objs param
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 6 Feb 2015 01:26:11 +0000 (17:26 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 6 Feb 2015 01:26:11 +0000 (17:26 -0800)
The remove_objs param is needed to atomically remove multiple entries
from the bucket index, e.g., when cancelling a multipart upload.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 0b6681b2f9f04c9a54b392ceb999a2fb4c86d8a5..53d0b6106b5d25ea4851eb218565c06bfc5943d6 100644 (file)
@@ -4246,7 +4246,7 @@ int RGWRados::Object::Delete::delete_obj()
 
   int64_t poolid = ref.ioctx.get_id();
   if (r >= 0 || r == -ENOENT) {
-    r = index_op.complete_del(poolid, ref.ioctx.get_last_version());
+    r = index_op.complete_del(poolid, ref.ioctx.get_last_version(), params.remove_objs);
   } else {
     int ret = index_op.cancel();
     if (ret < 0) {
@@ -4323,7 +4323,7 @@ int RGWRados::delete_obj_index(rgw_obj& obj)
   RGWRados::Bucket bop(this, bucket);
   RGWRados::Bucket::UpdateIndex index_op(&bop, obj, NULL);
 
-  int r = index_op.complete_del(-1 /* pool */, 0);
+  int r = index_op.complete_del(-1 /* pool */, 0, NULL);
 
   return r;
 }
@@ -5019,7 +5019,8 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch, uint
   return ret;
 }
 
-int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch)
+int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch,
+                                                list<rgw_obj_key> *remove_objs)
 {
   RGWRados *store = target->get_store();
   BucketShard *bs;
@@ -5028,7 +5029,7 @@ int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch)
     ldout(store->ctx(), 5) << "failed to get BucketShard object: ret=" << ret << dendl;
     return ret;
   }
-  return store->cls_obj_complete_del(*bs, optag, poolid, epoch, obj, bilog_flags);
+  return store->cls_obj_complete_del(*bs, optag, poolid, epoch, obj, remove_objs, bilog_flags);
 }
 
 
@@ -7401,11 +7402,13 @@ int RGWRados::cls_obj_complete_add(BucketShard& bs, string& tag,
 
 int RGWRados::cls_obj_complete_del(BucketShard& bs, string& tag,
                                    int64_t pool, uint64_t epoch,
-                                   rgw_obj& obj, uint16_t bilog_flags)
+                                   rgw_obj& obj,
+                                   list<rgw_obj_key> *remove_objs,
+                                   uint16_t bilog_flags)
 {
   RGWObjEnt ent;
   obj.get_index_key(&ent.key);
-  return cls_obj_complete_op(bs, CLS_RGW_OP_DEL, tag, pool, epoch, ent, RGW_OBJ_CATEGORY_NONE, NULL, bilog_flags);
+  return cls_obj_complete_op(bs, CLS_RGW_OP_DEL, tag, pool, epoch, ent, RGW_OBJ_CATEGORY_NONE, remove_objs, bilog_flags);
 }
 
 int RGWRados::cls_obj_complete_cancel(BucketShard& bs, string& tag, rgw_obj& obj, uint16_t bilog_flags)
index 7b70fcba47731ae8b42b97d75338e90c1dc6189c..e6fe72b60d5f823b61032f6a13d2f0c481be5ce1 100644 (file)
@@ -1555,8 +1555,9 @@ public:
         uint64_t olh_epoch;
         string marker_version_id;
         uint32_t bilog_flags;
+        list<rgw_obj_key> *remove_objs;
 
-        DeleteParams() : versioning_status(0), olh_epoch(0), bilog_flags(0) {}
+        DeleteParams() : versioning_status(0), olh_epoch(0), bilog_flags(0), remove_objs(NULL) {}
       } params;
 
       struct DeleteResult {
@@ -1616,7 +1617,8 @@ public:
                    utime_t& ut, string& etag, string& content_type,
                    bufferlist *acl_bl, RGWObjCategory category,
                   list<rgw_obj_key> *remove_objs);
-      int complete_del(int64_t poolid, uint64_t epoch);
+      int complete_del(int64_t poolid, uint64_t epoch,
+                       list<rgw_obj_key> *remove_objs);
       int cancel();
     };
 
@@ -1930,7 +1932,8 @@ public:
                           RGWObjEnt& ent, RGWObjCategory category, list<rgw_obj_key> *remove_objs, uint16_t bilog_flags);
   int cls_obj_complete_add(BucketShard& bs, string& tag, int64_t pool, uint64_t epoch, RGWObjEnt& ent,
                            RGWObjCategory category, list<rgw_obj_key> *remove_objs, uint16_t bilog_flags);
-  int cls_obj_complete_del(BucketShard& bs, string& tag, int64_t pool, uint64_t epoch, rgw_obj& obj, uint16_t bilog_flags);
+  int cls_obj_complete_del(BucketShard& bs, string& tag, int64_t pool, uint64_t epoch, rgw_obj& obj,
+                           list<rgw_obj_key> *remove_objs, uint16_t bilog_flags);
   int cls_obj_complete_cancel(BucketShard& bs, string& tag, rgw_obj& obj, uint16_t bilog_flags);
   int cls_obj_set_bucket_tag_timeout(rgw_bucket& bucket, uint64_t timeout);
   int cls_bucket_list(rgw_bucket& bucket, rgw_obj_key& start, const string& prefix,