diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 103fa2e8b656..9b38d8d52927 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -41,6 +41,8 @@ Bug Fixes * SOLR-15676: Fix PeerSync failure due to RealTimeGetComponent returning duplicates. (Ramsey Haddad, Christine Poerschke, David Smiley) +* SOLR-15732: queries to missing collection are slow (noble) + Build --------------------- 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 07515491a639..501f81ac0d2e 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 @@ protected void extractRemotePath(String collectionName, String origCorename) thr } 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 01618da3e68f..abd8f7676b4e 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,12 @@ public boolean update() throws KeeperException, InterruptedException { 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; + } + stat = new Stat(); final byte[] data = zkClient.getData(ALIASES, null, stat, true); return setIfNewer(Aliases.fromJSON(data, stat.getVersion())); }