lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [lucene-solr] branch master updated: SOLR-13454: Fix the method's behavior which caused test failures due to collections disappearing during iteration.
Date Tue, 14 May 2019 14:14:41 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 6f309df  SOLR-13454: Fix the method's behavior which caused test failures due to
collections disappearing during iteration.
6f309df is described below

commit 6f309dfa66bb788220af2568986893ab42916b14
Author: Andrzej Bialecki <ab@apache.org>
AuthorDate: Tue May 14 14:09:24 2019 +0200

    SOLR-13454: Fix the method's behavior which caused test failures due to collections disappearing
during iteration.
---
 .../src/java/org/apache/solr/common/cloud/ClusterState.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
index 970d95d..9907b9c 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
@@ -353,10 +353,19 @@ public class ClusterState implements JSONWriter.Writable {
   public Map<String, CollectionRef> getCollectionStates() {
     return immutableCollectionStates;
   }
+
+  /**
+   * Iterate over collections. Unlike {@link #getCollectionStates()} collections passed to
the
+   * consumer are guaranteed to exist.
+   * @param consumer collection consumer.
+   */
   public void forEachCollection(Consumer<DocCollection> consumer) {
     collectionStates.forEach((s, collectionRef) -> {
       try {
-        consumer.accept(collectionRef.get());
+        DocCollection collection = collectionRef.get();
+        if (collection != null) {
+          consumer.accept(collection);
+        }
       } catch (SolrException e) {
         if (e.getCause() instanceof KeeperException.NoNodeException) {
           //don't do anything. This collection does not exist


Mime
View raw message