]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: prevent bucket reshard scheduling if bucket is resharding 31298/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Fri, 27 Sep 2019 00:54:42 +0000 (20:54 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 31 Oct 2019 18:05:34 +0000 (19:05 +0100)
radosgw-admin should prevent a bucket from being added to the reshard
list if it is currently being resharded.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit f24a7eecdea70ff971f24f6f12748db80b1a43b2)

src/rgw/rgw_admin.cc

index 084aaa9cf54e38c37c8af9ff2ed63a2cf07a90bc..738608dc8f88856556595f9275b7062d51f943ec 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
 
 #include "include/util.h"
 
+#include "cls/rgw/cls_rgw_types.h"
 #include "cls/rgw/cls_rgw_client.h"
 
 #include "global/global_init.h"
@@ -2601,6 +2602,13 @@ int check_reshard_bucket_params(RGWRados *store,
     return ret;
   }
 
+  if (bucket_info.reshard_status != CLS_RGW_RESHARD_NOT_RESHARDING) {
+    // if in_progress or done then we have an old BucketInfo
+    cerr << "ERROR: the bucket is currently undergoing resharding and "
+      "cannot be added to the reshard list at this time" << std::endl;
+    return -EBUSY;
+  }
+
   int num_source_shards = (bucket_info.num_shards > 0 ? bucket_info.num_shards : 1);
 
   if (num_shards <= num_source_shards && !yes_i_really_mean_it) {