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 2021/03/12 03:52:50 UTC

[lucene-solr] branch reference_impl updated: @1462 Stress tweaks.

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 caf527a  @1462 Stress tweaks.
caf527a is described below

commit caf527a15f5ef3d55fff578b0bfb89482730a784
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Mar 11 21:52:26 2021 -0600

    @1462 Stress tweaks.
    
    Took 14 minutes
---
 .../java/org/apache/solr/cloud/ZkController.java   | 10 ++++-----
 .../apache/solr/cloud/overseer/ZkStateWriter.java  | 10 ++++-----
 .../CreateCollectionsIndexAndRestartTest.java      |  8 +++----
 .../org/apache/solr/common/cloud/SolrZkClient.java |  2 +-
 .../apache/solr/common/cloud/ZkStateReader.java    | 25 +++++++++++++++++-----
 5 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index a6b89cb..8d46016 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -153,11 +153,11 @@ public class ZkController implements Closeable, Runnable {
 
   @Override
   public void run() {
-//    try {
-//      publishNodeAs(getNodeName(), OverseerAction.DOWNNODE);
-//    } catch (Exception e) {
-//      log.warn("Problem publish node as DOWN", e);
-//    }
+    try {
+      publishNodeAs(getNodeName(), OverseerAction.DOWNNODE);
+    } catch (Exception e) {
+      log.warn("Problem publish node as DOWN", e);
+    }
     disconnect(true);
     log.info("Continuing to Solr shutdown");
   }
diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
index e62824b..7d5476c 100644
--- a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
+++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java
@@ -67,19 +67,19 @@ public class ZkStateWriter {
 
   protected volatile Stats stats;
 
-  private final Map<String,Integer> trackVersions = new ConcurrentHashMap<>();
+  private final Map<String,Integer> trackVersions = new ConcurrentHashMap<>(128, 0.75f, 16);
 
   private final Map<String, ZkNodeProps> stateUpdates = new ConcurrentHashMap<>();
 
   Map<String,DocCollection> failedUpdates = new ConcurrentHashMap<>();
 
-  Map<Long,String> idToCollection = new ConcurrentHashMap<>();
+  Map<Long,String> idToCollection = new ConcurrentHashMap<>(128, 0.75f, 16);
 
-  private Map<String,DocAssign> assignMap = new ConcurrentHashMap<>();
+  private Map<String,DocAssign> assignMap = new ConcurrentHashMap<>(128, 0.75f, 16);
 
-  private Map<String,ColState> collLocks = new ConcurrentHashMap<>();
+  private Map<String,ColState> collLocks = new ConcurrentHashMap<>(128, 0.75f, 16);
 
-  private final Map<String,DocCollection> cs = new ConcurrentHashMap<>();
+  private final Map<String,DocCollection> cs = new ConcurrentHashMap<>(128, 0.75f, 16);
 
   private static class ColState {
     ReentrantLock collLock = new ReentrantLock(true);
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CreateCollectionsIndexAndRestartTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CreateCollectionsIndexAndRestartTest.java
index e29c5fa..620b890 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CreateCollectionsIndexAndRestartTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CreateCollectionsIndexAndRestartTest.java
@@ -56,7 +56,7 @@ public class CreateCollectionsIndexAndRestartTest extends SolrCloudTestCase {
 
   @Test
   public void start() throws Exception {
-    int collectionCnt = 30;
+    int collectionCnt = 40;
     List<Future> futures = new ArrayList<>();
     List<Future> indexFutures = new ArrayList<>();
     for (int i = 0; i < collectionCnt; i ++) {
@@ -64,7 +64,7 @@ public class CreateCollectionsIndexAndRestartTest extends SolrCloudTestCase {
       Future<?> future = ParWork.getRootSharedExecutor().submit(() -> {
         try {
           log.info("Create Collection {}", collectionName);
-          CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2).setMaxShardsPerNode(100).process(cluster.getSolrClient());
+          CollectionAdminRequest.createCollection(collectionName, "conf", 4, 4).setMaxShardsPerNode(100).process(cluster.getSolrClient());
           StoppableIndexingThread indexThread;
           for (int j = 0; j < 2; j++) {
             indexThread = new StoppableIndexingThread(null, cluster.getSolrClient(), Integer.toString(j), false, 5, 10, false);
@@ -93,7 +93,7 @@ public class CreateCollectionsIndexAndRestartTest extends SolrCloudTestCase {
 
     for (int i = 0; i < collectionCnt; i ++) {
       final String collectionName = "testCollection" + i;
-      cluster.waitForActiveCollection(collectionName, 2, 4);
+      cluster.waitForActiveCollection(collectionName, 4, 16);
     }
 
 
@@ -111,7 +111,7 @@ public class CreateCollectionsIndexAndRestartTest extends SolrCloudTestCase {
     for (int r = 0; r < 2; r++) {
       for (int i = 0; i < collectionCnt; i++) {
         final String collectionName = "testCollection" + i;
-        cluster.waitForActiveCollection(collectionName, 2, 4);
+        cluster.waitForActiveCollection(collectionName, 4, 16);
       }
     }
   }
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 cb77507..80eea86 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
@@ -167,7 +167,7 @@ public class SolrZkClient implements Closeable {
       this.zkACLProvider = zkACLProvider;
     }
 
-    zkCmdExecutor = new ZkCmdExecutor(this, 3, new IsClosed() {
+    zkCmdExecutor = new ZkCmdExecutor(this, 15, new IsClosed() {
 
       @Override
       public boolean isClosed() {
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 06884e0..b10bda3 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -172,7 +172,7 @@ public class ZkStateReader implements SolrCloseable, Replica.NodeNameToBaseUrl {
   /**
    * A view of the current state of all collections.
    */
-  protected final Map<String,ClusterState.CollectionRef> clusterState = new ConcurrentHashMap(32, 0.75f, 5);
+  protected final Map<String,ClusterState.CollectionRef> clusterState = new ConcurrentHashMap<>(128, 0.75f, 16);
 
 
   private final int GET_LEADER_RETRY_DEFAULT_TIMEOUT = Integer.parseInt(System.getProperty("zkReaderGetLeaderRetryTimeoutMs", "1000"));
@@ -185,12 +185,12 @@ public class ZkStateReader implements SolrCloseable, Replica.NodeNameToBaseUrl {
   /**
    * "Interesting" and actively watched Collections.
    */
-  private final ConcurrentHashMap<String, DocCollection> watchedCollectionStates = new ConcurrentHashMap<>();
+  private final ConcurrentHashMap<String, DocCollection> watchedCollectionStates = new ConcurrentHashMap<>(128, 0.75f, 16);
 
   /**
    * "Interesting" but not actively watched Collections.
    */
-  private final ConcurrentHashMap<String, LazyCollectionRef> lazyCollectionStates = new ConcurrentHashMap<>();
+  private final ConcurrentHashMap<String, LazyCollectionRef> lazyCollectionStates = new ConcurrentHashMap<>(32, 0.75f, 16);
 
   /**
    * Collection properties being actively watched
@@ -216,11 +216,11 @@ public class ZkStateReader implements SolrCloseable, Replica.NodeNameToBaseUrl {
 
   private final Runnable securityNodeListener;
 
-  private final ConcurrentHashMap<String, CollectionWatch<DocCollectionWatcher>> collectionWatches = new ConcurrentHashMap<>(32, 0.75f, 3);
+  private final ConcurrentHashMap<String, CollectionWatch<DocCollectionWatcher>> collectionWatches = new ConcurrentHashMap<>(64, 0.75f, 16);
 
   private Set<String> registeredCores = ConcurrentHashMap.newKeySet();
 
-  private final Map<String,CollectionStateWatcher> stateWatchersMap = new ConcurrentHashMap<>(32, 0.75f, 3);
+  private final Map<String,CollectionStateWatcher> stateWatchersMap = new ConcurrentHashMap<>(64, 0.75f, 16);
 
   // named this observers so there's less confusion between CollectionPropsWatcher map and the PropsWatcher map.
   private final ConcurrentHashMap<String, CollectionWatch<CollectionPropsWatcher>> collectionPropsObservers = new ConcurrentHashMap<>();
@@ -391,6 +391,13 @@ public class ZkStateReader implements SolrCloseable, Replica.NodeNameToBaseUrl {
           log.error("problem fetching update collection state", e);
           return;
         }
+        String stateUpdatesPath = ZkStateReader.getCollectionStateUpdatesPath(name);
+        try {
+          newState = getAndProcessStateUpdates(name, stateUpdatesPath, false, newState, null);
+        } catch (Exception e) {
+          log.error("", e);
+          throw new SolrException(ErrorCode.SERVER_ERROR, e);
+        }
         if (updateWatchedCollection(name, newState, false)) {
           constructState(newState);
         }
@@ -421,6 +428,14 @@ public class ZkStateReader implements SolrCloseable, Replica.NodeNameToBaseUrl {
         return;
       }
 
+      String stateUpdatesPath = ZkStateReader.getCollectionStateUpdatesPath(name);
+      try {
+        newState = getAndProcessStateUpdates(name, stateUpdatesPath, false, newState, null);
+      } catch (Exception e) {
+        log.error("", e);
+        throw new SolrException(ErrorCode.SERVER_ERROR, e);
+      }
+
       if (updateWatchedCollection(name, newState, false)) {
         updatedCollections.add(newState);
       }