cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [08/13] cassandra git commit: Remove unnecessary sync flushing non-CFS indexes
Date Tue, 31 May 2016 08:45:28 GMT
Remove unnecessary sync flushing non-CFS indexes

Patch by Sam Tunnicliffe; reviewed by Branimir Lambov for CASSANDRA-9669


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/81ffc460
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/81ffc460
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/81ffc460

Branch: refs/heads/cassandra-3.7
Commit: 81ffc4601952ff3a9fec8493cd27fe52544ea115
Parents: 3303e47
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Thu May 19 12:04:38 2016 +0100
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Tue May 31 09:38:35 2016 +0100

----------------------------------------------------------------------
 .../apache/cassandra/index/SecondaryIndexManager.java    |  8 ++++----
 .../unit/org/apache/cassandra/index/CustomIndexTest.java | 11 +++++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/81ffc460/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
index 0a2e128..9635c59 100644
--- a/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/index/SecondaryIndexManager.java
@@ -478,10 +478,10 @@ public class SecondaryIndexManager implements IndexRegistry
      */
     public void flushAllNonCFSBackedIndexesBlocking()
     {
-        Set<Index> customIndexers = indexes.values().stream()
-                                                    .filter(index -> !(index.getBackingTable().isPresent()))
-                                                    .collect(Collectors.toSet());
-        flushIndexesBlocking(customIndexers);
+        executeAllBlocking(indexes.values()
+                                  .stream()
+                                  .filter(index -> !index.getBackingTable().isPresent()),
+                           Index::getBlockingFlushTask);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/81ffc460/test/unit/org/apache/cassandra/index/CustomIndexTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/index/CustomIndexTest.java b/test/unit/org/apache/cassandra/index/CustomIndexTest.java
index 9de3606..fa6700b 100644
--- a/test/unit/org/apache/cassandra/index/CustomIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/CustomIndexTest.java
@@ -55,6 +55,17 @@ public class CustomIndexTest extends CQLTester
     }
 
     @Test
+    public void testTruncateWithNonCfsCustomIndex() throws Throwable
+    {
+        // deadlocks and times out the test in the face of the synchronisation
+        // issues described in the comments on CASSANDRA-9669
+        createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a))");
+        createIndex("CREATE CUSTOM INDEX b_index ON %s(b) USING 'org.apache.cassandra.index.StubIndex'");
+        execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 1, 2);
+        getCurrentColumnFamilyStore().truncateBlocking();
+    }
+
+    @Test
     public void indexControlsIfIncludedInBuildOnNewSSTables() throws Throwable
     {
         createTable("CREATE TABLE %s (a int, b int, PRIMARY KEY (a))");


Mime
View raw message