Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Optimize ZkStateReader.refreshCollectionList (#2217)

David Smileyeb16ff157413
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index bab3ed4fa55..4c9b81d3826 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -94,6 +94,9 @@ Optimizations
---------------------
* SOLR-17144: Close searcherExecutor thread per core after 1 minute (Pierre Salagnac, Christine Poerschke)
+* GITHUB#2217: Scale to 10K+ collections better in ZkStateReader.refreshCollectionsList (David Smiley)
+
+
Bug Fixes
---------------------
(No changes)
@@ -176,7 +179,7 @@ Improvements
Now available at `GET /api/node/commands/someRequestId` (Sanjay Dutt via Jason Gerlowski)
* SOLR-17068: bin/solr post CLI use of options is now aligned closely with bin/post CLI tool, and is consistently
- referenced throughout the Ref Guide and source code, and is used through out our tests. The bin/post tool
+ referenced throughout the Ref Guide and source code, and is used through out our tests. The bin/post tool
remains and has been tested to work. (Eric Pugh)
Optimizations
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 9271fc44ee9..10496312022 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -678,7 +678,7 @@ public class ZkStateReader implements SolrCloseable {
// Don't mess with watchedCollections, they should self-manage.
// First, drop any children that disappeared.
- this.lazyCollectionStates.keySet().retainAll(children);
+ this.lazyCollectionStates.keySet().retainAll(new HashSet<>(children)); // Set avoids O(N^2)
for (String coll : children) {
// We will create an eager collection for any interesting collections, so don't add to lazy.
if (!collectionWatches.watchedCollections().contains(coll)) {