You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/13 00:05:27 UTC

[lucene-solr] 01/01: #105 Move a test to nightly, cache close buff, start moving zk req timeout up.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 9200f1a6038cc00afaf079a53c54eedc4163ce64
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Jul 12 19:05:10 2020 -0500

    #105 Move a test to nightly, cache close buff, start moving zk req timeout up.
---
 .../org/apache/solr/ltr/TestLTROnSolrCloud.java    |  2 ++
 .../java/org/apache/solr/search/CaffeineCache.java | 24 +++++++++++++++-------
 .../src/java/org/apache/solr/SolrTestCase.java     |  9 +++++++-
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
index 0167c55..309fee4 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java
@@ -19,6 +19,7 @@ import java.io.File;
 import java.util.SortedMap;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@@ -37,6 +38,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
 import org.junit.AfterClass;
 import org.junit.Test;
 
+@LuceneTestCase.Nightly
 public class TestLTROnSolrCloud extends TestRerankBase {
 
   private MiniSolrCloudCluster solrCluster;
diff --git a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
index 8da244b..363941d 100644
--- a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
+++ b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
@@ -37,6 +37,7 @@ import com.github.benmanes.caffeine.cache.RemovalCause;
 import com.github.benmanes.caffeine.cache.RemovalListener;
 import org.apache.lucene.util.Accountable;
 import org.apache.lucene.util.RamUsageEstimator;
+import org.apache.solr.common.ParWork;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.metrics.MetricsMap;
 import org.apache.solr.metrics.SolrMetricsContext;
@@ -87,7 +88,6 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements SolrCache<K, V
   private int maxIdleTimeSec;
   private boolean cleanupThread;
 
-  private Set<String> metricNames = ConcurrentHashMap.newKeySet();
   private MetricsMap cacheMap;
   private SolrMetricsContext solrMetricsContext;
 
@@ -232,13 +232,23 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements SolrCache<K, V
 
   @Override
   public void close() throws IOException {
-    SolrCache.super.close();
-    cache.invalidateAll();
-    cache.cleanUp();
-    if (executor instanceof ExecutorService) {
-      ((ExecutorService)executor).shutdownNow();
+    try (ParWork closer = new ParWork(this)) {
+      closer.collect(() -> {
+        try {
+          SolrCache.super.close();
+        } catch (IOException e) {
+          log.warn("IOException on close", e);
+        }
+      });
+      closer.collect(() -> {
+        cache.invalidateAll();
+        cache.cleanUp();
+      });
+      closer.collect(() -> {
+        ramBytes.reset();
+      });
+      closer.addCollect("CaffeineCacheClose");
     }
-    ramBytes.reset();
   }
 
   @Override
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index af73dab..a7a8f25 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -153,7 +153,6 @@ public class SolrTestCase extends LuceneTestCase {
     }
 
 
-    System.setProperty("zookeeper.request.timeout", "100");
     System.setProperty("solr.zkclienttimeout", "30000");
     System.setProperty("solr.v2RealPath", "true");
     System.setProperty("zookeeper.forceSync", "no");
@@ -167,6 +166,14 @@ public class SolrTestCase extends LuceneTestCase {
 
     if (!TEST_NIGHTLY) {
       //TestInjection.randomDelayMaxInCoreCreationInSec = 2;
+      System.setProperty("zookeeper.request.timeout", "300");
+      System.setProperty(SolrTestCaseJ4.USE_NUMERIC_POINTS_SYSPROP, "true");
+      System.setProperty("solr.tests.IntegerFieldType", "org.apache.solr.schema.IntPointField");
+      System.setProperty("solr.tests.FloatFieldType", "org.apache.solr.schema.FloatPointField");
+      System.setProperty("solr.tests.LongFieldType", "org.apache.solr.schema.LongPointField");
+      System.setProperty("solr.tests.DoubleFieldType", "org.apache.solr.schema.DoublePointField");
+      System.setProperty("solr.tests.DateFieldType", "org.apache.solr.schema.DatePointField");
+      System.setProperty("solr.tests.EnumFieldType", "org.apache.solr.schema.EnumFieldType");
 
       System.setProperty("solr.MaxConcurrentRequests", "5");
       System.setProperty("solr.tests.infostream", "false");