You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/04/01 00:36:25 UTC

[GitHub] [cassandra] yifan-c opened a new pull request #946: CASSANDRA-16554: Race between secondary index building and active compactions tracking

yifan-c opened a new pull request #946:
URL: https://github.com/apache/cassandra/pull/946


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cassandra] smiklosovic closed pull request #946: CASSANDRA-16554: Race between secondary index building and active compactions tracking

Posted by GitBox <gi...@apache.org>.
smiklosovic closed pull request #946:
URL: https://github.com/apache/cassandra/pull/946


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [cassandra] adelapena commented on a change in pull request #946: CASSANDRA-16554: Race between secondary index building and active compactions tracking

Posted by GitBox <gi...@apache.org>.
adelapena commented on a change in pull request #946:
URL: https://github.com/apache/cassandra/pull/946#discussion_r606654598



##########
File path: src/java/org/apache/cassandra/io/sstable/ReducingKeyIterator.java
##########
@@ -44,28 +44,34 @@ public ReducingKeyIterator(Collection<SSTableReader> sstables)
 
     private void maybeInit()
     {
-        if (mi == null)
+        if (mi != null)
+            return;
+
+        synchronized (this)
         {
-            mi = MergeIterator.get(iters, DecoratedKey.comparator, new MergeIterator.Reducer<DecoratedKey,DecoratedKey>()
+            if (mi == null)
             {
-                DecoratedKey reduced = null;
-
-                @Override
-                public boolean trivialReduceIsTrivial()
-                {
-                    return true;
-                }
-
-                public void reduce(int idx, DecoratedKey current)
-                {
-                    reduced = current;
-                }
-
-                protected DecoratedKey getReduced()
+                mi = MergeIterator.get(iters, DecoratedKey.comparator, new MergeIterator.Reducer<DecoratedKey,DecoratedKey>()

Review comment:
       Nit: missing whitespace
   ```suggestion
                   mi = MergeIterator.get(iters, DecoratedKey.comparator, new MergeIterator.Reducer<DecoratedKey, DecoratedKey>()
   ```
   ```suggestion
                   mi = MergeIterator.get(iters, DecoratedKey.comparator, new MergeIterator.Reducer<DecoratedKey,DecoratedKey>()
   ```

##########
File path: test/unit/org/apache/cassandra/db/compaction/ActiveCompactionsTest.java
##########
@@ -51,6 +58,50 @@
 
 public class ActiveCompactionsTest extends CQLTester
 {
+    @Test
+    public void testActiveCompactionTrackingRaceWithIndexBuilder() throws Throwable
+    {
+        createTable("CREATE TABLE %s (pk int, ck int, a int, b int, PRIMARY KEY (pk, ck))");
+        String idxName = createIndex("CREATE INDEX on %s(a)");
+        getCurrentColumnFamilyStore().disableAutoCompaction();
+        for (int i = 0; i < 5; i++)
+        {
+            execute("INSERT INTO %s (pk, ck, a, b) VALUES ("+i+", 2, 3, 4)");

Review comment:
       Nit: missed whitespaces
   ```suggestion
               execute("INSERT INTO %s (pk, ck, a, b) VALUES (" + i + ", 2, 3, 4)");
   ```
   ```suggestion
               execute("INSERT INTO %s (pk, ck, a, b) VALUES ("+i+", 2, 3, 4)");
   ```

##########
File path: src/java/org/apache/cassandra/io/sstable/ReducingKeyIterator.java
##########
@@ -33,7 +33,7 @@
 public class ReducingKeyIterator implements CloseableIterator<DecoratedKey>
 {
     private final ArrayList<KeyIterator> iters;
-    private IMergeIterator<DecoratedKey,DecoratedKey> mi;
+    private volatile IMergeIterator<DecoratedKey,DecoratedKey> mi;

Review comment:
       Nit: missed whitespace
   ```suggestion
       private volatile IMergeIterator<DecoratedKey, DecoratedKey> mi;
   ```
   ```suggestion
       private volatile IMergeIterator<DecoratedKey,DecoratedKey> mi;
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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