cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/7] git commit: Fix upgradesstables NPE for non-CF-based indexes patch by Sergio Bossa; reviewed by jbellis for CASSANDRA-6645
Date Thu, 06 Feb 2014 16:20:30 GMT
Fix upgradesstables NPE for non-CF-based indexes
patch by Sergio Bossa; reviewed by jbellis for CASSANDRA-6645


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

Branch: refs/heads/trunk
Commit: 8b6d87b86b0134221dd15fb74e96a9a8ee5ff1d9
Parents: adcb713
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Feb 6 10:16:41 2014 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Feb 6 10:16:41 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                           |  2 ++
 .../db/index/composites/CompositesSearcher.java       |  3 ++-
 .../apache/cassandra/db/index/keys/KeysSearcher.java  |  3 ++-
 .../org/apache/cassandra/service/StorageService.java  | 14 ++++++++++----
 4 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8b6d87b8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cfdd148..4be97f1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,8 @@
 1.2.16
+ * Fix upgradesstables NPE for non-CF-based indexes (CASSANDRA-6645)
  * Fix partition and range deletes not triggering flush (CASSANDRA-6655)
 
+
 1.2.15
  * Move handling of migration event source to solve bootstrap race (CASSANDRA-6648)
  * Make sure compaction throughput value doesn't overflow with int math (CASSANDRA-6647)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8b6d87b8/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java b/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
index 5ab1df6..3974466 100644
--- a/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/composites/CompositesSearcher.java
@@ -65,7 +65,7 @@ public class CompositesSearcher extends SecondaryIndexSearcher
                 continue;
 
             SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name);
-            if (index == null || (expression.op != IndexOperator.EQ))
+            if (index == null || index.getIndexCfs() == null || (expression.op != IndexOperator.EQ))
                 continue;
             int columns = index.getIndexCfs().getMeanColumns();
             candidates.put(index, columns);
@@ -106,6 +106,7 @@ public class CompositesSearcher extends SecondaryIndexSearcher
         final IndexExpression primary = highestSelectivityPredicate(filter.getClause());
         final SecondaryIndex index = indexManager.getIndexForColumn(primary.column_name);
         assert index != null;
+        assert index.getIndexCfs() != null;
         final DecoratedKey indexKey = index.getIndexKeyFor(primary.value);
 
         if (logger.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8b6d87b8/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
index bed6104..7e7595b 100644
--- a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
@@ -61,7 +61,7 @@ public class KeysSearcher extends SecondaryIndexSearcher
                 continue;
 
             SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name);
-            if (index == null || (expression.op != IndexOperator.EQ))
+            if (index == null || index.getIndexCfs() == null || (expression.op != IndexOperator.EQ))
                 continue;
             int columns = index.getIndexCfs().getMeanColumns();
             candidates.put(index, columns);
@@ -102,6 +102,7 @@ public class KeysSearcher extends SecondaryIndexSearcher
         final IndexExpression primary = highestSelectivityPredicate(filter.getClause());
         final SecondaryIndex index = indexManager.getIndexForColumn(primary.column_name);
         assert index != null;
+        assert index.getIndexCfs() != null;
         final DecoratedKey indexKey = index.getIndexKeyFor(primary.value);
 
         if (logger.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8b6d87b8/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 fa43154..94dd73d 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -2314,8 +2314,11 @@ public class StorageService extends NotificationBroadcasterSupport
implements IE
                 {
                     for (SecondaryIndex si : cfStore.indexManager.getIndexes())
                     {
-                        logger.info("adding secondary index {} to operation", si.getIndexName());
-                        valid.add(si.getIndexCfs());
+                        if (si.getIndexCfs() != null)
+                        {
+                            logger.info("adding secondary index {} to operation", si.getIndexName());
+                            valid.add(si.getIndexCfs());
+                        }
                     }
 
                 }
@@ -2364,8 +2367,11 @@ public class StorageService extends NotificationBroadcasterSupport
implements IE
                 {
                     for(SecondaryIndex si : cfStore.indexManager.getIndexes())
                     {
-                        logger.info("adding secondary index {} to operation", si.getIndexName());
-                        valid.add(si.getIndexCfs());
+                        if (si.getIndexCfs() != null)
+                        {
+                            logger.info("adding secondary index {} to operation", si.getIndexName());
+                            valid.add(si.getIndexCfs());
+                        }
                     }
                 }
             }


Mime
View raw message