From: Cory Snyder Date: Fri, 22 Sep 2023 21:00:46 +0000 (+0000) Subject: rgw: add test case to reproduce bucket check stats bug for versioned bucket X-Git-Tag: v17.2.7~29^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dca503c72f0f750300770d24725cb9490c5917bc;p=ceph.git rgw: add test case to reproduce bucket check stats bug for versioned bucket 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 (cherry picked from commit 340522f9aed50d65137568c1f9dcf4b1e7945a79) --- diff --git a/qa/workunits/rgw/test_rgw_bucket_check.py b/qa/workunits/rgw/test_rgw_bucket_check.py index 0a0e084dd9be7..bfa6d65d6e779 100755 --- a/qa/workunits/rgw/test_rgw_bucket_check.py +++ b/qa/workunits/rgw/test_rgw_bucket_check.py @@ -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')