cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [02/15] cassandra git commit: Avoid NPE on incremental repair failure
Date Thu, 21 Jan 2016 08:15:20 GMT
Avoid NPE on incremental repair failure

Patch by marcuse; reviewed by Carl Yeksigian for CASSANDRA-10909


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

Branch: refs/heads/cassandra-2.2
Commit: 98cc2c8d6cc27f1a2e675030a13b46fd336812f8
Parents: 1b02a6e
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Jan 12 08:19:04 2016 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Thu Jan 21 08:59:47 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 .../apache/cassandra/service/ActiveRepairService.java   | 12 +++++-------
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/98cc2c8d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9b1b79c..7175953 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.13
+ * Avoid NPE when incremental repair fails (CASSANDRA-10909)
  * Unmark sstables compacting once they are done in cleanup/scrub/upgradesstables (CASSANDRA-10829)
  * Revert CASSANDRA-10012 and add more logging (CASSANDRA-10961)
  * Allow simultaneous bootstrapping with strict consistency when no vnodes are used (CASSANDRA-11005)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/98cc2c8d/src/java/org/apache/cassandra/service/ActiveRepairService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/ActiveRepairService.java b/src/java/org/apache/cassandra/service/ActiveRepairService.java
index dd80d4c..732267e 100644
--- a/src/java/org/apache/cassandra/service/ActiveRepairService.java
+++ b/src/java/org/apache/cassandra/service/ActiveRepairService.java
@@ -428,15 +428,17 @@ public class ActiveRepairService
     {
         public final Map<UUID, ColumnFamilyStore> columnFamilyStores = new HashMap<>();
         public final Collection<Range<Token>> ranges;
-        public final Map<UUID, Set<SSTableReader>> sstableMap;
+        public final Map<UUID, Set<SSTableReader>> sstableMap = new HashMap<>();
         public final long repairedAt;
 
         public ParentRepairSession(List<ColumnFamilyStore> columnFamilyStores, Collection<Range<Token>>
ranges, long repairedAt)
         {
             for (ColumnFamilyStore cfs : columnFamilyStores)
+            {
                 this.columnFamilyStores.put(cfs.metadata.cfId, cfs);
+                sstableMap.put(cfs.metadata.cfId, new HashSet<SSTableReader>());
+            }
             this.ranges = ranges;
-            this.sstableMap = new HashMap<>();
             this.repairedAt = repairedAt;
         }
 
@@ -466,11 +468,7 @@ public class ActiveRepairService
 
         public void addSSTables(UUID cfId, Collection<SSTableReader> sstables)
         {
-            Set<SSTableReader> existingSSTables = this.sstableMap.get(cfId);
-            if (existingSSTables == null)
-                existingSSTables = new HashSet<>();
-            existingSSTables.addAll(sstables);
-            this.sstableMap.put(cfId, existingSSTables);
+            sstableMap.get(cfId).addAll(sstables);
         }
 
         @Override


Mime
View raw message