From: Yehuda Sadeh Date: Tue, 27 Sep 2016 21:11:41 +0000 (-0700) Subject: rgw: limit bucket reshard num shards to max possible X-Git-Tag: v10.2.6~22^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=139842d7451ef44cb0548676a818d3056e2e4ac6;p=ceph.git rgw: limit bucket reshard num shards to max possible Signed-off-by: Yehuda Sadeh (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 --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index b04aabc65aa..755a822b3d3 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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 attrs; int ret = init_bucket(tenant, bucket_name, bucket_id, bucket_info, bucket, &attrs); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 364f30c218a..f7f6a7e7aa9 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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 cached_rados_provider; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 3e20f5970bf..6116271dfe1 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -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& oids, bool *is_truncated);