You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/03/23 11:22:53 UTC

lucene-solr:branch_6x: disable query cache when this test uses threads, so seeds reliably reproduce

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 223568a23 -> 855763b06


disable query cache when this test uses threads, so seeds reliably reproduce


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/855763b0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/855763b0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/855763b0

Branch: refs/heads/branch_6x
Commit: 855763b063a2fc2e5e3f58f4738f85b41b488f8f
Parents: 223568a
Author: Mike McCandless <mi...@apache.org>
Authored: Wed Mar 23 06:20:26 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Wed Mar 23 06:23:53 2016 -0400

----------------------------------------------------------------------
 .../apache/lucene/spatial/util/BaseGeoPointTestCase.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/855763b0/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java b/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java
index f0334b2..0efe7d61 100644
--- a/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java
+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/util/BaseGeoPointTestCase.java
@@ -656,6 +656,13 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
     // We can't wrap with "exotic" readers because the BKD query must see the BKDDVFormat:
     IndexSearcher s = newSearcher(r, false);
 
+    if (useThreads) {
+      // We must disable query cache otherwise test seed may not reproduce since different
+      // threads may or may not get a cache hit or miss depending on order the JVM
+      // schedules the threads:
+      s.setQueryCache(null);
+    }
+
     // Make sure queries are thread safe:
     int numThreads;
     if (useThreads) {
@@ -765,8 +772,8 @@ public abstract class BaseGeoPointTestCase extends LuceneTestCase {
                     @Override
                     protected void describe(int docID, double pointLat, double pointLon) {
                       double distanceMeters = SloppyMath.haversinMeters(centerLat, centerLon, pointLat, pointLon);
-                      System.out.println("  docID=" + docID + " centerLon=" + centerLon + " centerLat=" + centerLat
-                          + " pointLon=" + pointLon + " pointLat=" + pointLat + " distanceMeters=" + distanceMeters
+                      System.out.println("  docID=" + docID + " centerLat=" + centerLat + " centerLon=" + centerLon
+                          + " pointLat=" + pointLat + " pointLon=" + pointLon + " distanceMeters=" + distanceMeters
                           + " vs" + ((rangeQuery == true) ? " minRadiusMeters=" + minRadiusMeters : "") + " radiusMeters=" + radiusMeters);
                     }
                    };