From 4497ce51c40fe04688d7a80e9b3241fe89e1db5e Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Wed, 1 Mar 2023 10:02:11 -0500 Subject: [PATCH] rgw: rgw::num_shards() returns 1 instead of 0 Signed-off-by: Casey Bodley --- src/rgw/rgw_bucket_layout.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.39.5