From: Casey Bodley Date: Wed, 1 Mar 2023 15:02:11 +0000 (-0500) Subject: rgw: rgw::num_shards() returns 1 instead of 0 X-Git-Tag: v19.0.0~1639^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4497ce51c40fe04688d7a80e9b3241fe89e1db5e;p=ceph.git rgw: rgw::num_shards() returns 1 instead of 0 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_bucket_layout.h b/src/rgw/rgw_bucket_layout.h index c974852cbae92..40aafd4dd8ded 100644 --- a/src/rgw/rgw_bucket_layout.h +++ b/src/rgw/rgw_bucket_layout.h @@ -262,7 +262,8 @@ void decode_json_obj(BucketLayout& l, JSONObj *obj); inline uint32_t num_shards(const bucket_index_normal_layout& index) { - return index.num_shards; + // old buckets used num_shards=0 to mean 1 + return index.num_shards > 0 ? index.num_shards : 1; } inline uint32_t num_shards(const bucket_index_layout& index) { ceph_assert(index.type == BucketIndexType::Normal);