diff options
Diffstat (limited to 'src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot02.py')
| -rw-r--r-- | src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot02.py | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot02.py b/src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot02.py index 89a7faddfc0..7ee28a240cc 100644 --- a/src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot02.py +++ b/src/third_party/wiredtiger/test/suite/test_checkpoint_snapshot02.py @@ -161,8 +161,15 @@ class test_checkpoint_snapshot02(wttest.WiredTigerTestCase): ckpt = checkpoint_thread(self.conn, done) try: ckpt.start() - # Sleep for sometime so that checkpoint starts before committing last transaction. - time.sleep(2) + + # Wait for checkpoint to start and acquire its snapshot before committing. + ckpt_snapshot = 0 + while not ckpt_snapshot: + time.sleep(1) + stat_cursor = self.session.open_cursor('statistics:', None, None) + ckpt_snapshot = stat_cursor[stat.conn.txn_checkpoint_snapshot_acquired][2] + stat_cursor.close() + session1.commit_transaction() finally: @@ -215,8 +222,15 @@ class test_checkpoint_snapshot02(wttest.WiredTigerTestCase): ckpt = checkpoint_thread(self.conn, done) try: ckpt.start() - # Sleep for sometime so that checkpoint starts before committing last transaction. - time.sleep(2) + + # Wait for checkpoint to start and acquire its snapshot before committing. + ckpt_snapshot = 0 + while not ckpt_snapshot: + time.sleep(1) + stat_cursor = self.session.open_cursor('statistics:', None, None) + ckpt_snapshot = stat_cursor[stat.conn.txn_checkpoint_snapshot_acquired][2] + stat_cursor.close() + session1.commit_transaction() finally: @@ -272,8 +286,15 @@ class test_checkpoint_snapshot02(wttest.WiredTigerTestCase): ckpt = checkpoint_thread(self.conn, done) try: ckpt.start() - # Sleep for sometime so that checkpoint starts before committing last transaction. - time.sleep(2) + + # Wait for checkpoint to start and acquire its snapshot before committing. + ckpt_snapshot = 0 + while not ckpt_snapshot: + time.sleep(1) + stat_cursor = self.session.open_cursor('statistics:', None, None) + ckpt_snapshot = stat_cursor[stat.conn.txn_checkpoint_snapshot_acquired][2] + stat_cursor.close() + session2.commit_transaction() finally: |
