You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2020/03/19 19:51:50 UTC

[cassandra] 02/02: Fixed flakey test in SASIIndexTest by shutting down its ExecutorService

This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 1a735f36b988157f1e7143852c4e3749649ee25d
Author: Gianluca Righetto <gi...@menttis.com>
AuthorDate: Fri Mar 6 03:45:17 2020 -0300

    Fixed flakey test in SASIIndexTest by shutting down its ExecutorService
    
    Patch by Gianluca Righetto, reviewed by Ekaterina Dimitrova and Zhao
    Yang for CASSANDRA-15528
---
 CHANGES.txt                                        |  1 +
 .../apache/cassandra/index/sasi/SASIIndexTest.java | 35 ++++++++++++----------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 8c8e74b..9621128 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0-alpha4
+ * Fixed flakey test in SASIIndexTest by shutting down its ExecutorService (CASSANDRA-15528)
  * Fixed empty check in TrieMemIndex due to potential state inconsistency in ConcurrentSkipListMap (CASSANDRA-15526)
  * Add compaction allocation measurement test (CASSANDRA-15388)
  * Added UnleveledSSTables global and table level metric (CASSANDRA-15620)
diff --git a/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java b/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java
index 0be05b9..c64bec9 100644
--- a/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java
@@ -1099,25 +1099,30 @@ public class SASIIndexTest
 
         int previousCount = 0;
 
-        do
+        try
         {
-            // this loop figures out if number of search results monotonically increasing
-            // to make sure that concurrent updates don't interfere with reads, uses first_name and age
-            // indexes to test correctness of both Trie and SkipList ColumnIndex implementations.
+            do
+            {
+                // this loop figures out if number of search results monotonically increasing
+                // to make sure that concurrent updates don't interfere with reads, uses first_name and age
+                // indexes to test correctness of both Trie and SkipList ColumnIndex implementations.
 
-            Set<DecoratedKey> rows = getPaged(store, 100, buildExpression(firstName, Operator.LIKE_CONTAINS, UTF8Type.instance.decompose("a")),
-                                                          buildExpression(age, Operator.EQ, Int32Type.instance.decompose(26)));
+                Set<DecoratedKey> rows = getPaged(store, 100, buildExpression(firstName, Operator.LIKE_CONTAINS, UTF8Type.instance.decompose("a")),
+                                                  buildExpression(age, Operator.EQ, Int32Type.instance.decompose(26)));
 
-            Assert.assertTrue(previousCount <= rows.size());
-            previousCount = rows.size();
-        }
-        while (updates.get() < writeCount);
-
-        // to make sure that after all of the writes are done we can read all "count" worth of rows
-        Set<DecoratedKey> rows = getPaged(store, 100, buildExpression(firstName, Operator.LIKE_CONTAINS, UTF8Type.instance.decompose("a")),
-                                                      buildExpression(age, Operator.EQ, Int32Type.instance.decompose(26)));
+                Assert.assertTrue(previousCount <= rows.size());
+                previousCount = rows.size();
+            }
+            while (updates.get() < writeCount);
 
-        Assert.assertEquals(writeCount, rows.size());
+            // to make sure that after all of the writes are done we can read all "count" worth of rows
+            Set<DecoratedKey> rows = getPaged(store, 100, buildExpression(firstName, Operator.LIKE_CONTAINS, UTF8Type.instance.decompose("a")),
+                            buildExpression(age, Operator.EQ, Int32Type.instance.decompose(26)));
+            Assert.assertEquals(writeCount, rows.size());
+        } finally {
+            scheduler.shutdownNow();
+            scheduler.awaitTermination(30, TimeUnit.SECONDS);
+        }
     }
 
     @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org