]> 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)
committerRobin H. Johnson <robin.johnson@dreamhost.com>
Thu, 9 Feb 2017 22:36:55 +0000 (14:36 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit d9c88afec4b52848f9ad8957bab5a86fdafecded)
See: http://tracker.ceph.com/issues/17556
See: https://github.com/ceph/ceph/pull/11368
Signed-off-by: Robin H. Johnson <robin.johnson@dreamhost.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index b04aabc65aa00e0fbf08629cdc6ad07050dd06f3..755a822b3d396cde22f39709c3391fe1ec809a13 100644 (file)
@@ -5044,6 +5044,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 364f30c218a57dc3ab090c2fc86145480eeb11bd..f7f6a7e7aa933a0077289c997c93c3838cc37b39 100644 (file)
@@ -63,8 +63,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 3e20f5970bfa2ceac2cf2d025c17023a475c8537..6116271dfe11f72d1c9d441fe66c73b144a4b1fa 100644 (file)
@@ -46,6 +46,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()) {
@@ -2024,6 +2026,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);