cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [2/6] cassandra git commit: Fail repair on non-existing table
Date Tue, 30 Aug 2016 15:38:30 GMT
Fail repair on non-existing table

Patch by Masataka Yamaguchi; Reviewed by Paulo Motta for CASSANDRA-12279


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

Branch: refs/heads/cassandra-3.0
Commit: acd46ab7c4e185e474026a0bfecdd2c5e77bf46d
Parents: 5f6a124
Author: Masataka Yamaguchi <p-myamaguchi@yahoo-corp.jp>
Authored: Wed Aug 24 17:15:41 2016 +0900
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Tue Aug 30 16:31:41 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 .../apache/cassandra/repair/RepairRunnable.java   | 18 ++++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/acd46ab7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 001a389..74c44f8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.8
+ * Fail repair on non-existing table (CASSANDRA-12279)
  * cqlsh copy: fix missing counter values (CASSANDRA-12476)
  * Move migration tasks to non-periodic queue, assure flush executor shutdown after non-periodic
executor (CASSANDRA-12251)
  * cqlsh copy: fixed possible race in initializing feeding thread (CASSANDRA-11701)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/acd46ab7/src/java/org/apache/cassandra/repair/RepairRunnable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/RepairRunnable.java b/src/java/org/apache/cassandra/repair/RepairRunnable.java
index f92310b..0f2e839 100644
--- a/src/java/org/apache/cassandra/repair/RepairRunnable.java
+++ b/src/java/org/apache/cassandra/repair/RepairRunnable.java
@@ -102,7 +102,7 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
     protected void fireErrorAndComplete(String tag, int progressCount, int totalProgress,
String message)
     {
         fireProgressEvent(tag, new ProgressEvent(ProgressEventType.ERROR, progressCount,
totalProgress, message));
-        fireProgressEvent(tag, new ProgressEvent(ProgressEventType.COMPLETE, progressCount,
totalProgress));
+        fireProgressEvent(tag, new ProgressEvent(ProgressEventType.COMPLETE, progressCount,
totalProgress, String.format("Repair command #%d finished with error", cmd)));
     }
 
     protected void runMayThrow() throws Exception
@@ -112,11 +112,21 @@ public class RepairRunnable extends WrappedRunnable implements ProgressEventNoti
         final String tag = "repair:" + cmd;
 
         final AtomicInteger progress = new AtomicInteger();
-        final int totalProgress = 3 + options.getRanges().size(); // calculate neighbors,
validation, prepare for repair + number of ranges to repair
+        final int totalProgress = 4 + options.getRanges().size(); // get valid column families,
calculate neighbors, validation, prepare for repair + number of ranges to repair
 
         String[] columnFamilies = options.getColumnFamilies().toArray(new String[options.getColumnFamilies().size()]);
-        Iterable<ColumnFamilyStore> validColumnFamilies = storageService.getValidColumnFamilies(false,
false, keyspace,
-                                                                                        
       columnFamilies);
+        Iterable<ColumnFamilyStore> validColumnFamilies;
+        try
+        {
+            validColumnFamilies = storageService.getValidColumnFamilies(false, false, keyspace,
columnFamilies);
+            progress.incrementAndGet();
+        }
+        catch (IllegalArgumentException e)
+        {
+            logger.error("Repair failed:", e);
+            fireErrorAndComplete(tag, progress.get(), totalProgress, e.getMessage());
+            return;
+        }
 
         final long startTime = System.currentTimeMillis();
         String message = String.format("Starting repair command #%d, repairing keyspace %s
with %s", cmd, keyspace,


Mime
View raw message