cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [3/5] git commit: Avoids NPE during repair when a keyspace has no CFs
Date Sun, 04 Mar 2012 10:15:47 GMT
Avoids NPE during repair when a keyspace has no CFs

patch by slebresne; reviewed by jbellis for CASSANDRA-3988


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

Branch: refs/heads/cassandra-1.1
Commit: ef01ca5bcf42fcf6c6a43a77eb4f0a90a93bbc1d
Parents: 53fb52a
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Sun Mar 4 11:06:16 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Sun Mar 4 11:06:16 2012 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/service/StorageService.java   |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ef01ca5b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ace4a9e..bc10ae2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@
  * add CompositeType ref to the CLI doc for create/update column family (CASSANDRA-3980)
  * Pig: support Counter ColumnFamilies (CASSANDRA-3973)
  * Pig: Composite column support (CASSANDRA-384)
+ * Avoid NPE during repair when a keyspace has no CFs (CASSANDRA-3988)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ef01ca5b/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 f82fe32..7f2f988 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1808,6 +1808,8 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
         for (Range range : ranges)
         {
             AntiEntropyService.RepairFuture future = forceTableRepair(range, tableName, columnFamilies);
+            if (future == null)
+                continue;
             futures.add(future);
             // wait for a session to be done with its differencing before starting the next
one
             try
@@ -1848,6 +1850,8 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
             return;
 
         AntiEntropyService.RepairFuture future = forceTableRepair(getLocalPrimaryRange(),
tableName, columnFamilies);
+        if (future == null)
+            return;
         try
         {
             future.get();
@@ -1867,6 +1871,12 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
             names.add(cfStore.getColumnFamilyName());
         }
 
+        if (names.isEmpty())
+        {
+            logger_.info("No column family to repair for keyspace " + tableName);
+            return null;
+        }
+
         return AntiEntropyService.instance.submitRepairSession(range, tableName, names.toArray(new
String[names.size()]));
     }
 


Mime
View raw message