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: v11.1.0~548^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d9c88afec4b52848f9ad8957bab5a86fdafecded;p=ceph.git rgw: limit bucket reshard num shards to max possible Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 58acac3257977..6eead05f25bdb 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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 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 187c446fc120d..8b378f79be0d3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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 cached_rados_provider; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 44ebcf7c59d54..8c1ab7d439cbe 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -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& oids, bool *is_truncated);