[ASTERIXDB-2196][TEST] Fix MultiPartitionLSMIndexTest
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- There is a small window where a flush can be scheduled
during the check of the component ids. This is avoided
now by waiting for all io operations.
Change-Id: I7da1ba5859aea4e75eca605113a1f72faa1914c2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2219
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java
index c12f50c..8b8c600 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java
@@ -562,9 +562,25 @@
}
// ensure that the insert completes
insertReq.await();
- // ensure the two memory components at partition 0 have different component ids
+ dsLifecycleMgr.getDatasetInfo(DATASET_ID).waitForIO();
+ // check first partition
+ List<ILSMDiskComponent> secondaryDiskComponents = secondaryLsmBtrees[0].getDiskComponents();
+ List<ILSMDiskComponent> primaryDiskComponents = primaryLsmBtrees[0].getDiskComponents();
+ for (int i = 0; i < secondaryDiskComponents.size(); i++) {
+ Assert.assertEquals(secondaryDiskComponents.get(i).getId(), primaryDiskComponents.get(i).getId());
+ }
+ // check second partition
+ secondaryDiskComponents = secondaryLsmBtrees[1].getDiskComponents();
+ primaryDiskComponents = primaryLsmBtrees[1].getDiskComponents();
+ for (int i = 0; i < secondaryDiskComponents.size(); i++) {
+ Assert.assertEquals(secondaryDiskComponents.get(i).getId(), primaryDiskComponents.get(i).getId());
+ }
+ // ensure the two memory components at partition 0 have the same component ids
Assert.assertEquals(primaryLsmBtrees[0].getCurrentMemoryComponent().getId(),
secondaryLsmBtrees[0].getCurrentMemoryComponent().getId());
+ // ensure the two memory components at partition 0 have the same component ids
+ Assert.assertEquals(primaryLsmBtrees[1].getCurrentMemoryComponent().getId(),
+ secondaryLsmBtrees[1].getCurrentMemoryComponent().getId());
} catch (Throwable e) {
e.printStackTrace();
Assert.fail(e.getMessage());