Skip to content

Commit ee2beec

Browse files
committed
qa/tasks/cephfs: add test for dump stray comamnd
Signed-off-by: Igor Golikov <[email protected]> Fixes: https://tracker.ceph.com/issues/56442
1 parent 801951e commit ee2beec

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

qa/tasks/cephfs/test_strays.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,3 +1022,32 @@ def test_replicated_delete_speed(self):
10221022

10231023
duration = (end - begin).total_seconds()
10241024
self.assertLess(duration, (file_count * tick_period) * 0.25)
1025+
1026+
def test_asok_dump_stray_command(self):
1027+
"""
1028+
Test MDS asok dump stray command
1029+
"""
1030+
1031+
LOW_LIMIT = 50
1032+
# need to create more folder to force fragmentation, creating more then needed
1033+
# to be on the safe side.
1034+
# we want to test the case when dumping stray folder must wait for the next dirfrag to be fetched
1035+
NUM_DIRS = LOW_LIMIT * 20
1036+
TOP_DIR = "topdir"
1037+
self.config_set("mds", "mds_bal_split_size", str(LOW_LIMIT))
1038+
self.assertEqual(self.config_get("mds", "mds_bal_split_size"), str(LOW_LIMIT), "LOW_LIMIT was not set on mds!")
1039+
1040+
# create 2 level tree with enough folders to force the stray folder be fragmented
1041+
# total of NUM_DIRS subdirs will be created
1042+
self.mount_a.run_shell(f"mkdir -p {TOP_DIR}/subdir{{1..{NUM_DIRS}}}")
1043+
# create snapshot
1044+
self.mount_a.run_shell(f"mkdir {TOP_DIR}/.snap/snap1")
1045+
1046+
# delete 2nd level dirs to generate strays
1047+
# don't wait, we want to dump stray dir while delete runs, to make it more interesting
1048+
self.mount_a.run_shell(f"rm -rf {TOP_DIR}/*", wait=False)
1049+
1050+
# wait for all deleted folders to become strays
1051+
self.wait_until_equal(
1052+
lambda: len(self.fs.rank_tell(["dump", "stray"])),
1053+
expect_val=NUM_DIRS, timeout=60, period=1)

0 commit comments

Comments
 (0)