]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add test case to reproduce bucket check stats bug for versioned bucket
authorCory Snyder <csnyder@1111systems.com>
Fri, 22 Sep 2023 21:00:46 +0000 (21:00 +0000)
committerCory Snyder <csnyder@1111systems.com>
Wed, 4 Oct 2023 08:54:49 +0000 (08:54 +0000)
Reproduces a regression where radosgw-admin bucket check incorrectly counts
objects that started as unversioned and later transitioned to versioned.

Signed-off-by: Cory Snyder <csnyder@1111systems.com>
(cherry picked from commit 340522f9aed50d65137568c1f9dcf4b1e7945a79)

qa/workunits/rgw/test_rgw_bucket_check.py

index 0a0e084dd9be73d14b13fb6afdcda96e0b026907..bfa6d65d6e7796ce72dbcf5f16bc4036bcb60efc 100755 (executable)
@@ -53,7 +53,15 @@ def main():
     ok_keys = ['a', 'b', 'c', 'd']
     unlinked_keys = ['c', 'd', 'e', 'f']
     ok_objs = put_objects(bucket, ok_keys)
-
+    
+    # TESTCASE 'recalculated bucket check stats are correct'
+    log.debug('TEST: recalculated bucket check stats are correct\n')
+    exec_cmd(f'radosgw-admin bucket check --fix --bucket {BUCKET_NAME}')
+    out = exec_cmd(f'radosgw-admin bucket stats --bucket {BUCKET_NAME}')
+    json_out = json.loads(out)
+    log.debug(json_out['usage'])
+    assert json_out['usage']['rgw.main']['num_objects'] == 6
+    
     # TESTCASE 'bucket check unlinked does not report normal entries'
     log.debug('TEST: bucket check unlinked does not report normal entries\n')
     out = exec_cmd(f'radosgw-admin bucket check unlinked --bucket {BUCKET_NAME} --min-age-hours 0 --dump-keys')