NPE fix on null highestSelectivityIndex

Patch by Berenguer Blasi; reviewed by Sam Tunnicliffe for
CASSANDRA-10550
This commit is contained in:
Bereng 2015-10-19 16:45:23 +02:00 committed by Sam Tunnicliffe
parent 86583af4ca
commit da8be1c093
3 changed files with 9 additions and 5 deletions

View File

@ -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)

View File

@ -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;
}
}
}

View File

@ -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());
}
}
}