]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: mark source bucket shards when starting reshard
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 9 May 2017 22:38:57 +0000 (15:38 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:43 +0000 (13:17 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_reshard.cc
src/rgw/rgw_reshard.h

index cac34a3e4327cd2902eecaa10a4581a7e53a56b9..94ef05adf3788e8bc1b73540ac2027e2d5b3ebbd 100644 (file)
@@ -214,15 +214,15 @@ void RGWBucketReshard::unlock_bucket()
   }
 }
 
-int RGWBucketReshard::init_resharding(const cls_rgw_reshard_entry& entry)
+int RGWBucketReshard::init_resharding(const string& new_instance_id)
 {
-  if (entry.new_instance_id.empty()) {
+  if (new_instance_id.empty()) {
     ldout(store->ctx(), 0) << __func__ << " missing new bucket instance id" << dendl;
     return -EINVAL;
   }
 
   cls_rgw_bucket_instance_entry instance_entry;
-  instance_entry.new_bucket_instance_id = entry.new_instance_id;
+  instance_entry.set(new_instance_id);
 
   int ret = store->bucket_set_reshard(bucket_info, instance_entry);
   if (ret < 0) {
@@ -408,6 +408,13 @@ int RGWBucketReshard::execute(int num_shards, int max_op_entries,
 
   ret = create_new_bucket_instance(num_shards, new_bucket_info);
   if (ret < 0) {
+    unlock_bucket();
+    return ret;
+  }
+
+  ret = init_resharding(new_bucket_info.bucket.bucket_id);
+  if (ret < 0) {
+    unlock_bucket();
     return ret;
   }
 
@@ -417,6 +424,7 @@ int RGWBucketReshard::execute(int num_shards, int max_op_entries,
                    verbose, out, formatter);
 
   if (ret < 0) {
+    unlock_bucket();
     return ret;
   }
 
index c8dcda5dbece6eb227e102e4815fd9de84a37656..da9ede7d1893cb8c482ff432e0f434538b911ef3 100644 (file)
@@ -44,7 +44,7 @@ class RGWBucketReshard {
 
   int lock_bucket();
   void unlock_bucket();
-  int init_resharding(const cls_rgw_reshard_entry& entry);
+  int init_resharding(const string& new_instance_id);
   int clear_resharding();
 
   int create_new_bucket_instance(int new_num_shards,