cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [04/10] cassandra git commit: NPE fix on null highestSelectivityIndex
Date Wed, 21 Oct 2015 08:36:21 GMT
NPE fix on null highestSelectivityIndex

Patch by Berenguer Blasi; reviewed by Sam Tunnicliffe for
CASSANDRA-10550


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

Branch: refs/heads/trunk
Commit: da8be1c093ba0a78604effd76769067e428ca04d
Parents: 86583af
Author: Bereng <berenguerblasi@gmail.com>
Authored: Mon Oct 19 16:45:23 2015 +0200
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Wed Oct 21 09:28:05 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/db/index/SecondaryIndexManager.java | 11 +++++++----
 src/java/org/apache/cassandra/service/StorageProxy.java  |  2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/da8be1c0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6734f75..2a28a86 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.12
+ * Fix potential NPE from handling result of SIM.highestSelectivityIndex (CASSANDRA-10550)
  * Fix paging issues with partitions containing only static columns data
    (CASSANDRA-10381)
  * Fix conditions on static columns (CASSANDRA-10264)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da8be1c0/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
index ad3aae8..12a0a55 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -858,11 +858,14 @@ public class SecondaryIndexManager
         for (SecondaryIndexSearcher searcher : indexSearchers)
         {
             SecondaryIndex highestSelectivityIndex = searcher.highestSelectivityIndex(clause);
-            long estimate = highestSelectivityIndex.estimateResultRows();
-            if (estimate <= bestEstimate)
+            if (highestSelectivityIndex != null)
             {
-                bestEstimate = estimate;
-                mostSelective = searcher;
+                long estimate = highestSelectivityIndex.estimateResultRows();
+                if (estimate <= bestEstimate)
+                {
+                    bestEstimate = estimate;
+                    mostSelective = searcher;
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da8be1c0/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index f8b4f1c..4f20ef0 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -1571,7 +1571,7 @@ public class StorageProxy implements StorageProxyMBean
                 {
                     // use our own mean column count as our estimate for how many matching
rows each node will have
                     SecondaryIndex highestSelectivityIndex = searcher.highestSelectivityIndex(command.rowFilter);
-                    resultRowsPerRange = Math.min(resultRowsPerRange, highestSelectivityIndex.estimateResultRows());
+                    resultRowsPerRange = highestSelectivityIndex == null ? resultRowsPerRange
: Math.min(resultRowsPerRange, highestSelectivityIndex.estimateResultRows());
                 }
             }
         }


Mime
View raw message