cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ble...@apache.org
Subject [1/5] cassandra git commit: Cleanup, scrub and upgrade may unmark compacting early (CASSANDRA-10274)
Date Wed, 09 Sep 2015 20:23:32 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk c5408a3a1 -> e5acb5604


Cleanup, scrub and upgrade may unmark compacting early (CASSANDRA-10274)

If an error occured during cleanup, scrub or upgrade
(or any parallelAllSSTableOperation), the caller was immediately
notified of the problem, and the method exited, executing the
finally block that unmarked all of the sstables as compacting.

Since the operations happen in parallel, many may still be running
or waiting to run, and so another operation may operate over the
same sstables, breaking the required mutual exclusivity.

This patch ensures the method is not exited until all operations
have completed, at which point the caller is notified of any
exceptions.

patch by benedict; reviewed by marcus for CASSANDRA-10274


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

Branch: refs/heads/trunk
Commit: 04e789bbcf283fe1d3b16613321ee169fa9f4e27
Parents: c2eb7bd
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Mon Sep 7 12:23:57 2015 +0100
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Tue Sep 8 13:24:18 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                      |  2 ++
 .../db/compaction/CompactionManager.java         |  3 +--
 .../org/apache/cassandra/utils/FBUtilities.java  | 19 ++++++++++++++++---
 .../org/apache/cassandra/utils/Throwables.java   |  5 +++++
 4 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/04e789bb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6d43c98..e3ad5e8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.1.10
+ * Scrub, Cleanup and Upgrade do not unmark compacting until all operations
+   have completed, regardless of the occurence of exceptions (CASSANDRA-10274)
  * Fix handling of streaming EOF (CASSANDRA-10206)
  * Only check KeyCache when it is enabled
  * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/04e789bb/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 3cfbe43..5d88a11 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -280,8 +280,7 @@ public class CompactionManager implements CompactionManagerMBean
                 }));
             }
 
-            for (Future<Object> f : futures)
-                f.get();
+            FBUtilities.waitOnFutures(futures);
         }
         finally
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/04e789bb/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index 1b118ba..214f2f5 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -344,10 +344,23 @@ public class FBUtilities
         return System.currentTimeMillis() * 1000;
     }
 
-    public static void waitOnFutures(Iterable<Future<?>> futures)
+    public static <T> List<T> waitOnFutures(Iterable<? extends Future<?
extends T>> futures)
     {
-        for (Future f : futures)
-            waitOnFuture(f);
+        List<T> results = new ArrayList<>();
+        Throwable fail = null;
+        for (Future<? extends T> f : futures)
+        {
+            try
+            {
+                results.add(f.get());
+            }
+            catch (InterruptedException | ExecutionException e)
+            {
+                fail = Throwables.merge(fail, e);
+            }
+        }
+        Throwables.maybeFail(fail);
+        return results;
     }
 
     public static <T> T waitOnFuture(Future<T> future)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/04e789bb/src/java/org/apache/cassandra/utils/Throwables.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/Throwables.java b/src/java/org/apache/cassandra/utils/Throwables.java
index 552ca87..0a2bd28 100644
--- a/src/java/org/apache/cassandra/utils/Throwables.java
+++ b/src/java/org/apache/cassandra/utils/Throwables.java
@@ -29,4 +29,9 @@ public class Throwables
         return existingFail;
     }
 
+    public static void maybeFail(Throwable fail)
+    {
+        if (fail != null)
+            com.google.common.base.Throwables.propagate(fail);
+    }
 }


Mime
View raw message