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/11 17:17:11 UTC
[lucene-solr] branch reference_impl updated: @1453 Need collection
prop too and fix race for tolerant test.
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 d2cd114 @1453 Need collection prop too and fix race for tolerant test.
d2cd114 is described below
commit d2cd11420364d45f0d1248cfaa4115419f487012
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Mar 11 11:14:20 2021 -0600
@1453 Need collection prop too and fix race for tolerant test.
Took 13 minutes
---
.../src/java/org/apache/solr/cloud/ZkController.java | 4 ++--
.../java/org/apache/solr/core/CoreDescriptor.java | 3 ++-
.../java/org/apache/solr/servlet/HttpSolrCall.java | 20 +++++++++++++++++++-
3 files changed, 23 insertions(+), 4 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 f731452..a6b89cb 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1269,7 +1269,7 @@ public class ZkController implements Closeable, Runnable {
if (docCollection != null) {
Replica replica = docCollection.getReplica(coreName);
if (replica != null && !baseUrl.equals(replica.getBaseUrl())) {
- log.error("wrong base url for this node in replica entry replica={}", replica);
+ log.error("IllegalStateException wrong base url for this node in replica entry replica={}", replica);
//throw new IllegalArgumentException("wrong base url for this node in replica entry baseUrl=" + baseUrl + " replica=" + replica);
}
}
@@ -1279,7 +1279,7 @@ public class ZkController implements Closeable, Runnable {
getZkStateReader().registerCore(cloudDesc.getCollectionName(), coreName);
- log.info("Register replica - core:{} address:{} collection:{} shard:{} type={}", coreName, baseUrl, collection, shardId, cloudDesc.getReplicaType());
+ log.info("Register replica - core={} id={} address={} collection={} shard={} type={}", coreName, desc.getCoreProperties().get("id"), baseUrl, collection, shardId, cloudDesc.getReplicaType());
log.info("Register terms for replica {}", coreName);
diff --git a/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java b/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
index d210de6..0aa5688 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
@@ -122,7 +122,8 @@ public class CoreDescriptor {
CORE_ROLES,
CORE_NODE_NAME,
CloudDescriptor.NUM_SHARDS,
- "id"
+ "id",
+ "collId"
);
private final CloudDescriptor cloudDesc;
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 2ac7ddd..a83165b 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -1114,8 +1114,26 @@ public class HttpSolrCall {
RandomIterator<Replica> it = new RandomIterator<>(random, replicas);
while (it.hasNext()) {
Replica replica = it.next();
- if (!checkActive || (liveNodes.contains(replica.getNodeName()) && replica.getState() == Replica.State.ACTIVE)) {
+ if (!checkActive || (liveNodes.contains(replica.getNodeName()))) {
SolrCore core = checkProps(replica);
+ if (core != null && checkActive && replica.getState() != Replica.State.ACTIVE) {
+ try {
+ cores.getZkController().getZkStateReader().waitForState(core.getCoreDescriptor().getCollectionName(), 1, TimeUnit.SECONDS, (liveNodes1, coll) -> {
+ if (coll == null) {
+ return false;
+ }
+ Replica rep = coll.getReplica(core.getName());
+ if (rep == null) {
+ return false;
+ }
+ if (rep.getState() != Replica.State.ACTIVE) {
+ return false;
+ }
+ return true;
+ });
+ } catch (InterruptedException e) {
+ } catch (TimeoutException e) { }
+ }
if (core != null) return core;
}
}