HDDS-1921. TestOzoneManagerDoubleBufferWithOMResponse is flaky (#1238)

This commit is contained in:
Doroszlai, Attila 2019-08-07 06:14:41 +02:00 committed by Bharat Viswanadham
parent a5bb1e8ee8
commit 9cd211ac86
1 changed files with 15 additions and 13 deletions

View File

@ -64,9 +64,9 @@ public class TestOzoneManagerDoubleBufferWithOMResponse {
private OMMetadataManager omMetadataManager; private OMMetadataManager omMetadataManager;
private OzoneManagerDoubleBuffer doubleBuffer; private OzoneManagerDoubleBuffer doubleBuffer;
private AtomicLong trxId = new AtomicLong(0); private final AtomicLong trxId = new AtomicLong(0);
private OzoneManagerRatisSnapshot ozoneManagerRatisSnapshot; private OzoneManagerRatisSnapshot ozoneManagerRatisSnapshot;
private long lastAppliedIndex; private volatile long lastAppliedIndex;
@Rule @Rule
public TemporaryFolder folder = new TemporaryFolder(); public TemporaryFolder folder = new TemporaryFolder();
@ -345,21 +345,23 @@ public class TestOzoneManagerDoubleBufferWithOMResponse {
} }
// We are doing +1 for volume transaction. // We are doing +1 for volume transaction.
GenericTestUtils.waitFor(() -> long expectedTransactions = (bucketCount + 1) * iterations;
doubleBuffer.getFlushedTransactionCount() == GenericTestUtils.waitFor(() -> lastAppliedIndex == expectedTransactions,
(bucketCount + 1) * iterations, 100, 100, 120000);
120000);
Assert.assertTrue(omMetadataManager.countRowsInTable( Assert.assertEquals(expectedTransactions,
omMetadataManager.getVolumeTable()) == iterations); doubleBuffer.getFlushedTransactionCount()
);
Assert.assertTrue(omMetadataManager.countRowsInTable( Assert.assertEquals(iterations,
omMetadataManager.getBucketTable()) == (bucketCount) * iterations); omMetadataManager.countRowsInTable(omMetadataManager.getVolumeTable())
);
Assert.assertEquals(bucketCount * iterations,
omMetadataManager.countRowsInTable(omMetadataManager.getBucketTable())
);
Assert.assertTrue(doubleBuffer.getFlushIterations() > 0); Assert.assertTrue(doubleBuffer.getFlushIterations() > 0);
// Check lastAppliedIndex is updated correctly or not.
Assert.assertEquals((bucketCount + 1) * iterations, lastAppliedIndex);
} finally { } finally {
stop(); stop();
} }