Repository: cassandra Updated Branches: refs/heads/cassandra-2.2 716b253a7 -> 44c7bdec9
Fix flakiness in RangeTombstoneTest patch by Ariel Weisberg; reviewed by Aleksey Yeschenko for CASSANDRA-9523 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/44c7bdec Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/44c7bdec Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/44c7bdec Branch: refs/heads/cassandra-2.2 Commit: 44c7bdec9ad2085db1c99230e49adfbd8eb2e0c9 Parents: 716b253 Author: Ariel Weisberg <[email protected]> Authored: Fri Jun 5 13:02:20 2015 -0400 Committer: Aleksey Yeschenko <[email protected]> Committed: Sat Jun 20 22:31:45 2015 +0300 ---------------------------------------------------------------------- .../org/apache/cassandra/db/RangeTombstoneTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/44c7bdec/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java index 34e592a..9ce1236 100644 --- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java +++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java @@ -26,6 +26,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; @@ -572,7 +573,10 @@ public class RangeTombstoneTest { ColumnDefinition cd = new ColumnDefinition(cfs.metadata, indexedColumnName, Int32Type.instance, null, ColumnDefinition.Kind.REGULAR); cd.setIndex("test_index", IndexType.CUSTOM, ImmutableMap.of(SecondaryIndex.CUSTOM_INDEX_OPTION_NAME, TestIndex.class.getName())); - cfs.indexManager.addIndexedColumn(cd); + Future<?> rebuild = cfs.indexManager.addIndexedColumn(cd); + // If rebuild there is, wait for the rebuild to finish so it doesn't race with the following insertions + if (rebuild != null) + rebuild.get(); } TestIndex index = ((TestIndex)cfs.indexManager.getIndexForColumn(indexedColumnName)); @@ -615,7 +619,11 @@ public class RangeTombstoneTest { ColumnDefinition cd = ColumnDefinition.regularDef(cfs.metadata, indexedColumnName, cfs.getComparator().asAbstractType(), 0) .setIndex("test_index", IndexType.CUSTOM, ImmutableMap.of(SecondaryIndex.CUSTOM_INDEX_OPTION_NAME, TestIndex.class.getName())); - cfs.indexManager.addIndexedColumn(cd); + Future<?> rebuild = cfs.indexManager.addIndexedColumn(cd); + // If rebuild there is, wait for the rebuild to finish so it doesn't race with the following insertions + if (rebuild != null) + rebuild.get(); + } TestIndex index = ((TestIndex)cfs.indexManager.getIndexForColumn(indexedColumnName));
