From: lu.shasha Date: Tue, 9 May 2017 07:05:03 +0000 (+0800) Subject: rgw: when create_bucket use the same num_shards with info.num_shards X-Git-Tag: v11.2.1~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f72ea6818691e1824d4c22630e856d3b280a008c;p=ceph.git rgw: when create_bucket use the same num_shards with info.num_shards pr #14388 only fix the num_shards in BucketInfo, "init_bucket_index" function still use local num_shards Fixes: http://tracker.ceph.com/issues/19745 Signed-off-by: Shasha Lu (cherry picked from commit 4ce64a190b4ff36985e785e574c077d39796feea) Conflicts: src/rgw/rgw_rados.cc - init_bucket_index() called earlier --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 0c409d0da2e..ffad88c7ba2 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -5396,8 +5396,13 @@ int RGWRados::create_bucket(RGWUserInfo& owner, rgw_bucket& bucket, bucket.marker = pmaster_bucket->marker; bucket.bucket_id = pmaster_bucket->bucket_id; } + if (pmaster_num_shards) { + info.num_shards = *pmaster_num_shards; + } else { + info.num_shards = bucket_index_max_shards; + } - int r = init_bucket_index(bucket, bucket_index_max_shards); + int r = init_bucket_index(bucket, info.num_shards); if (r < 0) return r; @@ -5416,11 +5421,6 @@ int RGWRados::create_bucket(RGWUserInfo& owner, rgw_bucket& bucket, info.index_type = rule_info.index_type; info.swift_ver_location = swift_ver_location; info.swift_versioning = (!swift_ver_location.empty()); - if (pmaster_num_shards) { - info.num_shards = *pmaster_num_shards; - } else { - info.num_shards = bucket_index_max_shards; - } info.bucket_index_shard_hash_type = RGWBucketInfo::MOD; info.requester_pays = false; if (real_clock::is_zero(creation_time)) {