]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: limit bucket reshard num shards to max possible
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 27 Sep 2016 21:11:41 +0000 (14:11 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 19 Oct 2016 15:41:49 +0000 (08:41 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 58acac3257977219ea28904f51ee5110a124ac4e..6eead05f25bdbe429da364db69247bc505c7cb22 100644 (file)
@@ -4873,6 +4873,11 @@ next:
       return EINVAL;
     }
 
+    if (num_shards > (int)store->get_max_bucket_shards()) {
+      cerr << "ERROR: num_shards too high, max value: " << store->get_max_bucket_shards() << std::endl;
+      return EINVAL;
+    }
+
     RGWBucketInfo bucket_info;
     map<string, bufferlist> attrs;
     int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs);
index 187c446fc120dd51968d089a34b9aa504d065bb8..8b378f79be0d3ee008c9ab017a14658794c27ddb 100644 (file)
@@ -72,8 +72,6 @@ using namespace librados;
 
 #define dout_subsys ceph_subsys_rgw
 
-#define MAX_BUCKET_INDEX_SHARDS_PRIME 7877
-
 using namespace std;
 
 static RGWCache<RGWRados> cached_rados_provider;
index 44ebcf7c59d54cd638d8b4f3ff638c56935e2d09..8c1ab7d439cbece5d689f054e49295cb24e7321f 100644 (file)
@@ -49,6 +49,8 @@ class RGWRESTConn;
 
 #define RGW_NO_SHARD -1
 
+#define MAX_BUCKET_INDEX_SHARDS_PRIME 7877
+
 static inline void prepend_bucket_marker(rgw_bucket& bucket, const string& orig_oid, string& oid)
 {
   if (bucket.marker.empty() || orig_oid.empty()) {
@@ -2085,6 +2087,10 @@ public:
   int get_required_alignment(rgw_bucket& bucket, uint64_t *alignment);
   int get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size);
 
+  uint32_t get_max_bucket_shards() {
+    return MAX_BUCKET_INDEX_SHARDS_PRIME;
+  }
+
   int list_raw_objects(rgw_bucket& pool, const string& prefix_filter, int max,
                        RGWListRawObjsCtx& ctx, list<string>& oids,
                        bool *is_truncated);