From e4039b98994589939c1e187d9c8a9e1c5f61756d Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Tue, 23 Nov 2021 04:37:01 -0500 Subject: [PATCH] qa: wait for purge queue operations to finish TestFragmentation.test_deep_split relies on `num_strays` to reach zero expecting that the purge threads would have deleted the directory entries. However, checking `num_strays` cannot be relied on since PurqeQueue merely journals the purge item (see PurgeQueue::push) followed by the StrayManager marking the stray as removed thereby accounting `num_strays`. So, add an additional condition to check if the purge threads have finished processing items. Fixes: http://tracker.ceph.com/issues/52487 Signed-off-by: Venky Shankar (cherry picked from commit d9c79983230a9237422998771db4b4c450aed949) --- qa/tasks/cephfs/test_fragment.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qa/tasks/cephfs/test_fragment.py b/qa/tasks/cephfs/test_fragment.py index 41977ca202836..1102f887b5f0a 100644 --- a/qa/tasks/cephfs/test_fragment.py +++ b/qa/tasks/cephfs/test_fragment.py @@ -214,11 +214,14 @@ class TestFragmentation(CephFSTestCase): self.fs.mds_asok(['flush', 'journal']) + def _check_pq_finished(): + num_strays = self.fs.mds_asok(['perf', 'dump', 'mds_cache'])['mds_cache']['num_strays'] + pq_ops = self.fs.mds_asok(['perf', 'dump', 'purge_queue'])['purge_queue']['pq_executing'] + return num_strays == 0 and pq_ops == 0 + # Wait for all strays to purge - self.wait_until_equal( - lambda: self.fs.mds_asok(['perf', 'dump', 'mds_cache'] - )['mds_cache']['num_strays'], - 0, + self.wait_until_true( + lambda: _check_pq_finished(), timeout=1200 ) # Check that the metadata pool objects for all the myriad -- 2.39.5