lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thelabd...@apache.org
Subject svn commit: r1694389 - in /lucene/dev/branches/lucene_solr_5_3: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/update/VersionInfo.java solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java
Date Thu, 06 Aug 2015 01:15:22 GMT
Author: thelabdude
Date: Thu Aug  6 01:15:22 2015
New Revision: 1694389

URL: http://svn.apache.org/r1694389
Log:
SOLR-7866: Harden code to prevent an unhandled NPE when trying to determine the max value
of the version field.

Modified:
    lucene/dev/branches/lucene_solr_5_3/   (props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/   (props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/update/VersionInfo.java
    lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java

Modified: lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt?rev=1694389&r1=1694388&r2=1694389&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt Thu Aug  6 01:15:22 2015
@@ -213,6 +213,9 @@ Bug Fixes
 * SOLR-7818: Fixed distributed stats to be calculated for all the query terms. Earlier the
stats were calculated with
   the terms that are present in the last shard of a distributed request. (Varun Thacker,
Anshum Gupta)
 
+* SOLR-7866: VersionInfo caused an unhandled NPE when trying to determine the max value for
the
+  version field. (Timothy Potter)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/update/VersionInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/update/VersionInfo.java?rev=1694389&r1=1694388&r2=1694389&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/update/VersionInfo.java
(original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/update/VersionInfo.java
Thu Aug  6 01:15:22 2015
@@ -230,8 +230,9 @@ public class VersionInfo {
     // if indexed, then we have terms to get the max from
     if (versionField.indexed()) {
       Terms versionTerms = searcher.getLeafReader().terms(versionFieldName);
-      if (versionTerms != null) {
-        maxVersionInIndex = NumericUtils.getMaxLong(versionTerms);
+      Long max = (versionTerms != null) ? NumericUtils.getMaxLong(versionTerms) : null;
+      if (max != null) {
+        maxVersionInIndex = max.longValue();
         log.info("Found MAX value {} from Terms for {} in index", maxVersionInIndex, versionFieldName);
       } else {
         log.info("No terms found for {}, cannot seed version bucket highest value from index",
versionFieldName);

Modified: lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java?rev=1694389&r1=1694388&r2=1694389&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java
(original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java
Thu Aug  6 01:15:22 2015
@@ -88,6 +88,11 @@ public class DistributedVersionInfoTest
     List<Replica> notLeaders =
         ensureAllReplicasAreActive(testCollectionName, shardId, 1, rf, maxWaitSecsToSeeAllActive);
 
+    // start by reloading the empty collection so we try to calculate the max from an empty
index
+    reloadCollection(leader, testCollectionName);
+    notLeaders =
+        ensureAllReplicasAreActive(testCollectionName, shardId, 1, rf, maxWaitSecsToSeeAllActive);
+
     sendDoc(1);
     cloudClient.commit();
 



Mime
View raw message