Make repair no-op when RF=1

patch by yukim; reviewed by krummas for CASSANDRA-7864


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

Branch: refs/heads/cassandra-2.1
Commit: 46ef9628fa4035c26d81c4a070ebd270e59e5520
Parents: 77b036a
Author: Yuki Morishita <yu...@apache.org>
Authored: Fri Sep 5 10:22:33 2014 -0500
Committer: Yuki Morishita <yu...@apache.org>
Committed: Fri Sep 5 10:22:33 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                               | 1 +
 src/java/org/apache/cassandra/service/StorageService.java | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ef9628/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7be8979..54fcc4f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,7 @@
    (CASSANDRA-7722)
  * Always send Paxos commit to all replicas (CASSANDRA-7479)
  * Make disruptor_thrift_server invocation pool configurable (CASSANDRA-7594)
+ * Make repair no-op when RF=1 (CASSANDRA-7864)
 
 
 2.0.10

http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ef9628/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java 
b/src/java/org/apache/cassandra/service/StorageService.java
index f16e187..12d6420 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -2404,7 +2404,7 @@ public class StorageService extends 
NotificationBroadcasterSupport implements IE
 
     public int forceRepairAsync(final String keyspace, final boolean 
isSequential, final Collection<String> dataCenters, final Collection<String> 
hosts,  final Collection<Range<Token>> ranges, final String... columnFamilies)
     {
-        if (Keyspace.SYSTEM_KS.equals(keyspace) || ranges.isEmpty())
+        if (ranges.isEmpty() || 
Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2)
             return 0;
 
         final int cmd = nextRepairCommand.incrementAndGet();
@@ -2428,7 +2428,7 @@ public class StorageService extends 
NotificationBroadcasterSupport implements IE
 
     public int forceRepairAsync(String keyspace, boolean isSequential, boolean 
isLocal, Collection<Range<Token>> ranges, String... columnFamilies)
     {
-        if (Keyspace.SYSTEM_KS.equals(keyspace) || ranges.isEmpty())
+        if (ranges.isEmpty() || 
Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2)
             return 0;
 
         final int cmd = nextRepairCommand.incrementAndGet();
@@ -2497,7 +2497,7 @@ public class StorageService extends 
NotificationBroadcasterSupport implements IE
 
     public void forceKeyspaceRepairRange(final String keyspaceName, final 
Collection<Range<Token>> ranges, boolean isSequential, boolean isLocal, final 
String... columnFamilies) throws IOException
     {
-        if (Keyspace.SYSTEM_KS.equalsIgnoreCase(keyspaceName))
+        if (ranges.isEmpty() || 
Keyspace.open(keyspaceName).getReplicationStrategy().getReplicationFactor() < 2)
             return;
         createRepairTask(nextRepairCommand.incrementAndGet(), keyspaceName, 
ranges, isSequential, isLocal, columnFamilies).run();
     }

Reply via email to