You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2021/11/01 06:38:20 UTC

[lucene-solr] 01/01: fixed

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

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

commit c5a7bdd29d7eb4958d2727db674a377eef6a1c84
Author: Noble Paul <no...@gmail.com>
AuthorDate: Mon Nov 1 17:37:19 2021 +1100

    fixed
---
 solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java        | 5 ++++-
 solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 0751549..501f81a 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -441,7 +441,10 @@ public class HttpSolrCall {
     } else {
       if (!retry) {
         // we couldn't find a core to work with, try reloading aliases & this collection
-        cores.getZkController().getZkStateReader().aliasesManager.update();
+        if(!cores.getZkController().getZkStateReader().aliasesManager.update()) {
+          //no change. go back
+          return;
+        }
         cores.getZkController().zkStateReader.forceUpdateCollection(collectionName);
         action = RETRY;
       }
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 01618da..ce58399 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
@@ -2269,7 +2269,11 @@ public class ZkStateReader implements SolrCloseable {
       log.debug("Checking ZK for most up to date Aliases {}", ALIASES);
       // Call sync() first to ensure the subsequent read (getData) is up to date.
       zkClient.getSolrZooKeeper().sync(ALIASES, null, null);
-      Stat stat = new Stat();
+      Stat stat = zkClient.exists(ALIASES, null, true);
+      if (stat.getVersion() <= aliases.getZNodeVersion()) {
+        //we already have the latest version.
+        return false;
+      }
       final byte[] data = zkClient.getData(ALIASES, null, stat, true);
       return setIfNewer(Aliases.fromJSON(data, stat.getVersion()));
     }