You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2019/03/04 13:09:58 UTC

[cassandra] branch trunk updated: Avoid CME when cancelling compactions for anticompaction

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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 6b3ea1e  Avoid CME when cancelling compactions for anticompaction
6b3ea1e is described below

commit 6b3ea1e1a480c9f9a2f6f813443daa4c6866e2ff
Author: Marcus Eriksson <ma...@apache.org>
AuthorDate: Tue Feb 26 18:53:01 2019 +0100

    Avoid CME when cancelling compactions for anticompaction
    
    Patch by marcuse; reviewed by Sam Tunnicliffe for CASSANDRA-15036
---
 .../apache/cassandra/db/compaction/ActiveCompactions.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/java/org/apache/cassandra/db/compaction/ActiveCompactions.java b/src/java/org/apache/cassandra/db/compaction/ActiveCompactions.java
index bba0601..5bcb06f 100644
--- a/src/java/org/apache/cassandra/db/compaction/ActiveCompactions.java
+++ b/src/java/org/apache/cassandra/db/compaction/ActiveCompactions.java
@@ -56,13 +56,16 @@ public class ActiveCompactions implements ActiveCompactionsTracker
     public CompactionInfo getCompactionForSSTable(SSTableReader sstable)
     {
         CompactionInfo toReturn = null;
-        for (CompactionInfo.Holder holder : compactions)
+        synchronized (compactions)
         {
-            if (holder.getCompactionInfo().getSSTables().contains(sstable))
+            for (CompactionInfo.Holder holder : compactions)
             {
-                if (toReturn != null)
-                    throw new IllegalStateException("SSTable "+sstable+" involved in several compactions");
-                toReturn = holder.getCompactionInfo();
+                if (holder.getCompactionInfo().getSSTables().contains(sstable))
+                {
+                    if (toReturn != null)
+                        throw new IllegalStateException("SSTable " + sstable + " involved in several compactions");
+                    toReturn = holder.getCompactionInfo();
+                }
             }
         }
         return toReturn;


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