]> 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>
Fri, 30 Sep 2016 17:16:37 +0000 (10:16 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
Conflicts:
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.h

src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index a31fa65f5fc860f0fb0e6b7d1a7aa183418324cc..1fa9dbe4f807acdf3d15967efe90c2a703fb7e0f 100644 (file)
@@ -2686,6 +2686,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(bucket_name, bucket_id, bucket_info, bucket, &attrs);
index 7073fcd925bc65fe4a2bc7be9915e74a09e289f6..a8ded2dc9eca85e3672d8f6bcfdc7e80edec72d3 100644 (file)
@@ -50,8 +50,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 2c8860d645c3b3455e56729ae91b568e571e48e8..75401cc95fa46557fa9247b70f21c463f1cbf502 100644 (file)
@@ -32,6 +32,8 @@ class RGWGC;
 
 #define RGW_BUCKET_INSTANCE_MD_PREFIX ".bucket.meta."
 
+#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()) {
@@ -1325,6 +1327,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);