]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw::num_shards() returns 1 instead of 0
authorCasey Bodley <cbodley@redhat.com>
Wed, 1 Mar 2023 15:02:11 +0000 (10:02 -0500)
committerCasey Bodley <cbodley@redhat.com>
Wed, 1 Mar 2023 15:02:11 +0000 (10:02 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_bucket_layout.h

index c974852cbae92ce826c927ea8f84a97f72cc5820..40aafd4dd8dede1c5388612f2d073bd05c0b2de1 100644 (file)
@@ -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);