From f72ea6818691e1824d4c22630e856d3b280a008c Mon Sep 17 00:00:00 2001 From: "lu.shasha" Date: Tue, 9 May 2017 15:05:03 +0800 Subject: [PATCH] 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 --- src/rgw/rgw_rados.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 0c409d0da2e44..ffad88c7ba255 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)) { -- 2.39.5