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/16 06:47:32 UTC

[lucene-solr] branch reference_impl updated: @195 - Working on low end hardware and stopping.

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 125a8b7  @195 - Working on low end hardware and stopping.
125a8b7 is described below

commit 125a8b7a0145b9c72b1fd5a4d925b70c5d6836b0
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Jul 16 01:47:13 2020 -0500

    @195 - Working on low end hardware and stopping.
---
 .../java/org/apache/solr/core/CoreContainer.java   |  2 +-
 .../java/org/apache/solr/handler/IndexFetcher.java |  8 +++++---
 .../apache/solr/update/DefaultSolrCoreState.java   |  5 ++++-
 .../solr/client/solrj/cloud/ProtocolSupport.java   |  5 -----
 .../client/solrj/cloud/ZooKeeperOperation.java     |  2 --
 .../solr/common/cloud/ConnectionManager.java       | 22 +++++++++++++---------
 .../org/apache/solr/common/cloud/SolrZkClient.java |  8 +-------
 .../src/java/org/apache/solr/SolrTestCase.java     |  6 +++---
 8 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 7b2a543..b86a966 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -390,7 +390,7 @@ public class CoreContainer implements Closeable {
     if (solrCoreLoadExecutor == null) {
       synchronized (CoreContainer.class) {
         if (solrCoreLoadExecutor == null) {
-          solrCoreLoadExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Math.max(4, Runtime.getRuntime().availableProcessors() / 2),
+          solrCoreLoadExecutor = new ExecutorUtil.MDCAwareThreadPoolExecutor(0, Math.max(3, Runtime.getRuntime().availableProcessors() / 2),
                   3, TimeUnit.SECONDS,
                   new BlockingArrayQueue<>(100, 10),
                   new SolrNamedThreadFactory("SolrCoreLoader"));
diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
index a6e6a31..6b769e8 100644
--- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
+++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
@@ -160,7 +160,7 @@ public class IndexFetcher {
 
   private boolean useExternalCompression = false;
 
-  boolean fetchFromLeader = false;
+  final boolean fetchFromLeader;
 
   private final HttpClient myHttpClient;
 
@@ -236,6 +236,8 @@ public class IndexFetcher {
     Object fetchFromLeader = initArgs.get(FETCH_FROM_LEADER);
     if (fetchFromLeader != null && fetchFromLeader instanceof Boolean) {
       this.fetchFromLeader = (boolean) fetchFromLeader;
+    } else {
+      this.fetchFromLeader = false;
     }
     Object skipCommitOnMasterVersionZero = initArgs.get(SKIP_COMMIT_ON_MASTER_VERSION_ZERO);
     if (skipCommitOnMasterVersionZero != null && skipCommitOnMasterVersionZero instanceof Boolean) {
@@ -255,13 +257,13 @@ public class IndexFetcher {
     String compress = (String) initArgs.get(COMPRESSION);
     useInternalCompression = INTERNAL.equals(compress);
     useExternalCompression = EXTERNAL.equals(compress);
-    connTimeout = getParameter(initArgs, HttpClientUtil.PROP_CONNECTION_TIMEOUT, 30000, null);
+    connTimeout = getParameter(initArgs, HttpClientUtil.PROP_CONNECTION_TIMEOUT, 5000, null);
     
     // allow a master override for tests - you specify this in /replication slave section of solrconfig and some 
     // test don't want to define this
     soTimeout = Integer.getInteger("solr.indexfetcher.sotimeout", -1);
     if (soTimeout == -1) {
-      soTimeout = getParameter(initArgs, HttpClientUtil.PROP_SO_TIMEOUT, Integer.getInteger("solr.indexfetch.so_timeout.default", 120000), null);
+      soTimeout = getParameter(initArgs, HttpClientUtil.PROP_SO_TIMEOUT, Integer.getInteger("solr.indexfetch.so_timeout.default", 15000), null);
     }
 
     if (initArgs.getBooleanArg(TLOG_FILES) != null) {
diff --git a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
index de3e332..9a8dde3 100644
--- a/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
+++ b/solr/core/src/java/org/apache/solr/update/DefaultSolrCoreState.java
@@ -302,7 +302,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
 
   @Override
   public void doRecovery(CoreContainer cc, CoreDescriptor cd) {
-    if (prepForClose) {
+    if (prepForClose || cc.isShutDown()) {
       return;
     }
     Runnable recoveryTask = new Runnable() {
@@ -353,6 +353,9 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
 
               recoveryStrat = recoveryStrategyBuilder.create(cc, cd, DefaultSolrCoreState.this);
               recoveryStrat.setRecoveringAfterStartup(recoveringAfterStartup);
+              if (prepForClose || cc.isShutDown()) {
+                return;
+              }
               recoveryStrat.run();
             } finally {
               recoveryLock.unlock();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ProtocolSupport.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ProtocolSupport.java
index 2c3eedc..a20e725 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ProtocolSupport.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ProtocolSupport.java
@@ -138,8 +138,6 @@ public class ProtocolSupport {
     /**
      * Ensures that the given path exists with no data, the current
      * ACL and no flags.
-     *
-     * @param path
      */
     protected void ensurePathExists(String path) {
         ensureExists(path, null, acl, CreateMode.PERSISTENT);
@@ -148,9 +146,6 @@ public class ProtocolSupport {
     /**
      * Ensures that the given path exists with the given data, ACL and flags.
      *
-     * @param path
-     * @param acl
-     * @param flags
      */
     protected void ensureExists(
         final String path,
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ZooKeeperOperation.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ZooKeeperOperation.java
index e316405..387f302 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ZooKeeperOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/ZooKeeperOperation.java
@@ -27,8 +27,6 @@ public interface ZooKeeperOperation {
      * to ZooKeeper closes during this operation.
      *
      * @return the result of the operation or null
-     * @throws KeeperException
-     * @throws InterruptedException
      */
     boolean execute() throws KeeperException, InterruptedException;
 
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
index 726164f..adccada 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
@@ -98,16 +98,13 @@ public class ConnectionManager implements Watcher, Closeable {
 
   private volatile LikelyExpiredState likelyExpiredState = LikelyExpiredState.EXPIRED;
 
-  private IsClosed isClosedCheck;
-
-  public ConnectionManager(String name, SolrZkClient client, String zkServerAddress, ZkClientConnectionStrategy strat, OnReconnect onConnect, BeforeReconnect beforeReconnect, IsClosed isClosed) {
+  public ConnectionManager(String name, SolrZkClient client, String zkServerAddress, ZkClientConnectionStrategy strat, OnReconnect onConnect, BeforeReconnect beforeReconnect) {
     this.name = name;
     this.client = client;
     this.connectionStrategy = strat;
     this.zkServerAddress = zkServerAddress;
     this.onReconnect = onConnect;
     this.beforeReconnect = beforeReconnect;
-    this.isClosedCheck = isClosed;
   }
 
   private void connected() {
@@ -189,9 +186,11 @@ public class ConnectionManager implements Watcher, Closeable {
 
                     try {
                       client.updateKeeper(keeper);
+                    } catch (InterruptedException e) {
+                      ParWork.propegateInterrupt(e);
+                      return;
                     } catch (Exception e) {
                       log.error("$ZkClientConnectionStrategy.ZkUpdate.update(SolrZooKeeper=" + keeper + ")", e);
-                      ParWork.propegateInterrupt(e);
                       SolrException exp = new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
                       try {
                         closeKeeper(keeper);
@@ -208,11 +207,13 @@ public class ConnectionManager implements Watcher, Closeable {
                       onReconnect.command();
                     }
 
+                  } catch (InterruptedException e) {
+                    ParWork.propegateInterrupt(e);
+                    return;
                   } catch (Exception e1) {
-                    ParWork.propegateInterrupt(e1);
+                    log.error("Exception updating zk instance", e1);
                     SolrException exp = new SolrException(SolrException.ErrorCode.SERVER_ERROR, e1);
 
-
                     // if there was a problem creating the new SolrZooKeeper
                     // or if we cannot run our reconnect command, close the keeper
                     // our retry loop will try to create one again
@@ -234,6 +235,9 @@ public class ConnectionManager implements Watcher, Closeable {
 
           break;
 
+        } catch (InterruptedException e) {
+          ParWork.propegateInterrupt(e);
+          return;
         } catch (Exception e) {
           ParWork.propegateInterrupt(e);
           if (e instanceof  InterruptedException) {
@@ -243,7 +247,7 @@ public class ConnectionManager implements Watcher, Closeable {
           log.info("Could not connect due to error, trying again");
         }
 
-      } while (!isClosed());
+      } while (!isClosed() && !client.isClosed());
 
       log.info("zkClient Connected: {}", connected);
     } else if (state == KeeperState.Disconnected) {
@@ -271,7 +275,7 @@ public class ConnectionManager implements Watcher, Closeable {
   }
 
   private boolean isClosed() {
-    return isClosed || isClosedCheck.isClosed();
+    return client.isClosed() || isClosed;
   }
 
   public boolean isLikelyExpired() {
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
index dadff3e..9ca2faa 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
@@ -216,13 +216,7 @@ public class SolrZkClient implements Closeable {
       }
     });
     connManager = new ConnectionManager("ZooKeeperConnection Watcher:"
-        + zkServerAddress, this, zkServerAddress, strat, onReconnect, beforeReconnect, new IsClosed() {
-
-          @Override
-          public boolean isClosed() {
-            return SolrZkClient.this.isClosed();
-          }
-        });
+        + zkServerAddress, this, zkServerAddress, strat, onReconnect, beforeReconnect);
 
     try {
       strat.connect(zkServerAddress, zkClientTimeout, wrapWatcher(connManager),
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 923d7eb..7510119 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -182,7 +182,7 @@ public class SolrTestCase extends LuceneTestCase {
 
     if (!TEST_NIGHTLY) {
       //TestInjection.randomDelayMaxInCoreCreationInSec = 2;
-      System.setProperty("zookeeper.request.timeout", "1000");
+      System.setProperty("zookeeper.request.timeout", "5000");
       System.setProperty(SolrTestCaseJ4.USE_NUMERIC_POINTS_SYSPROP, "false");
 //      System.setProperty("solr.tests.IntegerFieldType", "org.apache.solr.schema.IntPointField");
 //      System.setProperty("solr.tests.FloatFieldType", "org.apache.solr.schema.FloatPointField");
@@ -213,8 +213,8 @@ public class SolrTestCase extends LuceneTestCase {
 
       System.setProperty("solr.disableMetricsHistoryHandler", "true");
 
-      System.setProperty("solr.leaderThrottle", "0");
-      System.setProperty("solr.recoveryThrottle", "0");
+      System.setProperty("solr.leaderThrottle", "1000");
+      System.setProperty("solr.recoveryThrottle", "1000");
 
       System.setProperty("solr.suppressDefaultConfigBootstrap", "true");