Skip to content

Commit db9825d

Browse files
committed
qa: make all replayer threads busy and query 'syncing' status
* Make all replayer threads busy and then query for 'syncing' state instead of just fetching the current status. * Dropped 'current_syncing_snap' check, as it's not compulsory for this test. The actual intension is to make threads in 'syncing' status and 'current_syncing_snap' check is not necessary for that. * Drop 'snaps_deleted' metrics check in test_cephfs_mirror_cancel_mirroring_and_readd. test_cephfs_mirror_cancel_mirroring_and_readd primarily focusses on the synchronization of the newly added directory paths post removal of the previously added/syncing directory paths. So checking of 'snaps_deleted' metrics is unnecessary here. * Wait for more time to finish the new snapshot creations and the sync backoff. We need to wait for more time in test_cephfs_mirror_cancel_mirroring_and_readd, as the test makes all replayer threads busy. Fixes: https://tracker.ceph.com/issues/64711 Signed-off-by: Jos Collin <[email protected]>
1 parent bd78bdc commit db9825d

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

qa/tasks/cephfs/test_mirroring.py

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ def test_cephfs_mirror_cancel_mirroring_and_readd(self):
13611361
self.mount_b.umount_wait()
13621362
self.mount_b.mount_wait(cephfs_name=self.secondary_fs_name)
13631363

1364-
# create a bunch of files in a directory to snap
1364+
# create some large files in 3 directories to snap
13651365
self.mount_a.run_shell(["mkdir", "d0"])
13661366
self.mount_a.run_shell(["mkdir", "d1"])
13671367
self.mount_a.run_shell(["mkdir", "d2"])
@@ -1384,30 +1384,38 @@ def test_cephfs_mirror_cancel_mirroring_and_readd(self):
13841384
vbefore = res[TestMirroring.PERF_COUNTER_KEY_NAME_CEPHFS_MIRROR_PEER][0]
13851385
# take snapshots
13861386
log.debug('taking snapshots')
1387-
self.mount_a.run_shell(["mkdir", "d0/.snap/snap0"])
1388-
self.mount_a.run_shell(["mkdir", "d1/.snap/snap0"])
1389-
self.mount_a.run_shell(["mkdir", "d2/.snap/snap0"])
1387+
snap_name = "snap0"
1388+
self.mount_a.run_shell(["mkdir", f"d0/.snap/{snap_name}"])
1389+
self.mount_a.run_shell(["mkdir", f"d1/.snap/{snap_name}"])
1390+
self.mount_a.run_shell(["mkdir", f"d2/.snap/{snap_name}"])
13901391

1391-
time.sleep(10)
13921392
log.debug('checking snap in progress')
1393-
self.check_peer_snap_in_progress(self.primary_fs_name, self.primary_fs_id,
1394-
"client.mirror_remote@ceph", '/d0', 'snap0')
1395-
self.check_peer_snap_in_progress(self.primary_fs_name, self.primary_fs_id,
1396-
"client.mirror_remote@ceph", '/d1', 'snap0')
1397-
self.check_peer_snap_in_progress(self.primary_fs_name, self.primary_fs_id,
1398-
"client.mirror_remote@ceph", '/d2', 'snap0')
1393+
peer_spec = "client.mirror_remote@ceph"
1394+
peer_uuid = self.get_peer_uuid(peer_spec)
1395+
with safe_while(sleep=3, tries=100, action=f'wait for status: {peer_spec}') as proceed:
1396+
while proceed():
1397+
res = self.mirror_daemon_command(f'peer status for fs: {self.primary_fs_name}',
1398+
'fs', 'mirror', 'peer', 'status',
1399+
f'{self.primary_fs_name}@{self.primary_fs_id}',
1400+
peer_uuid)
1401+
if ('syncing' == res["/d0"]['state'] and 'syncing' == res["/d1"]['state'] and \
1402+
'syncing' == res["/d2"]['state']):
1403+
break
13991404

1400-
log.debug('removing directories 1')
1405+
log.debug('removing directory 1')
14011406
self.remove_directory(self.primary_fs_name, self.primary_fs_id, '/d0')
1402-
log.debug('removing directories 2')
1407+
log.debug('removing directory 2')
14031408
self.remove_directory(self.primary_fs_name, self.primary_fs_id, '/d1')
1404-
log.debug('removing directories 3')
1409+
log.debug('removing directory 3')
14051410
self.remove_directory(self.primary_fs_name, self.primary_fs_id, '/d2')
14061411

1412+
# Wait a while for the sync backoff
1413+
time.sleep(500)
1414+
14071415
log.debug('removing snapshots')
1408-
self.mount_a.run_shell(["rmdir", "d0/.snap/snap0"])
1409-
self.mount_a.run_shell(["rmdir", "d1/.snap/snap0"])
1410-
self.mount_a.run_shell(["rmdir", "d2/.snap/snap0"])
1416+
self.mount_a.run_shell(["rmdir", f"d0/.snap/{snap_name}"])
1417+
self.mount_a.run_shell(["rmdir", f"d1/.snap/{snap_name}"])
1418+
self.mount_a.run_shell(["rmdir", f"d2/.snap/{snap_name}"])
14111419

14121420
for i in range(4):
14131421
filename = f'file.{i}'
@@ -1427,26 +1435,27 @@ def test_cephfs_mirror_cancel_mirroring_and_readd(self):
14271435
self.add_directory(self.primary_fs_name, self.primary_fs_id, '/d2')
14281436

14291437
log.debug('creating new snapshots...')
1430-
self.mount_a.run_shell(["mkdir", "d0/.snap/snap0"])
1431-
self.mount_a.run_shell(["mkdir", "d1/.snap/snap0"])
1432-
self.mount_a.run_shell(["mkdir", "d2/.snap/snap0"])
1438+
self.mount_a.run_shell(["mkdir", f"d0/.snap/{snap_name}"])
1439+
self.mount_a.run_shell(["mkdir", f"d1/.snap/{snap_name}"])
1440+
self.mount_a.run_shell(["mkdir", f"d2/.snap/{snap_name}"])
1441+
1442+
# Wait for the threads to finish
1443+
time.sleep(500)
14331444

1434-
time.sleep(60)
14351445
self.check_peer_status(self.primary_fs_name, self.primary_fs_id,
1436-
"client.mirror_remote@ceph", '/d0', 'snap0', 1)
1437-
self.verify_snapshot('d0', 'snap0')
1446+
"client.mirror_remote@ceph", '/d0', f'{snap_name}', 1)
1447+
self.verify_snapshot('d0', f'{snap_name}')
14381448

14391449
self.check_peer_status(self.primary_fs_name, self.primary_fs_id,
1440-
"client.mirror_remote@ceph", '/d1', 'snap0', 1)
1441-
self.verify_snapshot('d1', 'snap0')
1450+
"client.mirror_remote@ceph", '/d1', f'{snap_name}', 1)
1451+
self.verify_snapshot('d1', f'{snap_name}')
14421452

14431453
self.check_peer_status(self.primary_fs_name, self.primary_fs_id,
1444-
"client.mirror_remote@ceph", '/d2', 'snap0', 1)
1445-
self.verify_snapshot('d2', 'snap0')
1454+
"client.mirror_remote@ceph", '/d2', f'{snap_name}', 1)
1455+
self.verify_snapshot('d2', f'{snap_name}')
14461456
res = self.mirror_daemon_command(f'counter dump for fs: {self.primary_fs_name}', 'counter', 'dump')
14471457
vafter = res[TestMirroring.PERF_COUNTER_KEY_NAME_CEPHFS_MIRROR_PEER][0]
14481458
self.assertGreater(vafter["counters"]["snaps_synced"], vbefore["counters"]["snaps_synced"])
1449-
self.assertGreater(vafter["counters"]["snaps_deleted"], vbefore["counters"]["snaps_deleted"])
14501459

14511460
self.disable_mirroring(self.primary_fs_name, self.primary_fs_id)
14521461

0 commit comments

Comments
 (0)