]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: clone operation should only update index for main category
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 29 Dec 2011 00:34:03 +0000 (16:34 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 29 Dec 2011 00:34:03 +0000 (16:34 -0800)
src/rgw/rgw_rados.cc

index 2fa01c4480aa2f692ef7f1bc13edb4c65947e536..0e3c9fc8d7b4024d4e09080b2bb0c780322fb373 100644 (file)
@@ -1509,6 +1509,8 @@ int RGWRados::clone_objs_impl(void *ctx, rgw_obj& dst_obj,
   string etag;
   string content_type;
   bufferlist acl_bl;
+  bool update_index = (category == RGW_OBJ_CATEGORY_MAIN ||
+                       category == RGW_OBJ_CATEGORY_MULTIMETA);
 
   int r = open_bucket_ctx(bucket, io_ctx);
   if (r < 0)
@@ -1584,9 +1586,13 @@ int RGWRados::clone_objs_impl(void *ctx, rgw_obj& dst_obj,
 
   string tag;
   uint64_t epoch = 0;
-  int ret = prepare_update_index(state, bucket, dst_obj, tag);
-  if (ret < 0)
-    goto done;
+  int ret;
+
+  if (update_index) {
+    ret = prepare_update_index(state, bucket, dst_obj, tag);
+    if (ret < 0)
+      goto done;
+  }
 
   ret = io_ctx.operate(dst_oid, &op);
 
@@ -1595,7 +1601,7 @@ int RGWRados::clone_objs_impl(void *ctx, rgw_obj& dst_obj,
 done:
   atomic_write_finish(state, ret);
 
-  if (ret >= 0) {
+  if (update_index && ret >= 0) {
     ret = complete_update_index(bucket, dst_obj.object, tag, epoch, size,
                                 ut, etag, content_type, &acl_bl, category);
   }