You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2015/03/24 19:25:16 UTC
svn commit: r1668953 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/cloud/ZkController.java
Author: varun
Date: Tue Mar 24 18:25:15 2015
New Revision: 1668953
URL: http://svn.apache.org/r1668953
Log:
SOLR-7248: In legacyCloud=false mode we should check if the core was hosted on the same node before registering it (merging from trunk)
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1668953&r1=1668952&r2=1668953&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Tue Mar 24 18:25:15 2015
@@ -226,6 +226,9 @@ Bug Fixes
* SOLR-7141: RecoveryStrategy: Raise time that we wait for any updates from the leader before
they saw the recovery state to have finished. (Mark Miller)
+* SOLR-7248: In legacyCloud=false mode we should check if the core was hosted on the same node before registering it
+ (Varun Thacker, Noble Paul, Mark Miller)
+
Optimizations
----------------------
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1668953&r1=1668952&r2=1668953&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java Tue Mar 24 18:25:15 2015
@@ -1526,21 +1526,33 @@ public final class ZkController {
CloudDescriptor cloudDesc = cd.getCloudDescriptor();
String coreNodeName = cloudDesc.getCoreNodeName();
assert coreNodeName != null;
- if (cloudDesc.getShardId() == null) throw new SolrException(ErrorCode.SERVER_ERROR ,"No shard id for :" + cd);
+ if (cloudDesc.getShardId() == null) {
+ throw new SolrException(ErrorCode.SERVER_ERROR ,"No shard id for :" + cd);
+ }
long endTime = System.nanoTime() + TimeUnit.NANOSECONDS.convert(3, TimeUnit.SECONDS);
- String errMessage= null;
- for (; System.nanoTime()<endTime; ) {
- Thread.sleep(100);
- errMessage = null;
+ String errMessage = null;
+ while (System.nanoTime() < endTime) {
Slice slice = zkStateReader.getClusterState().getSlice(cd.getCollectionName(), cloudDesc.getShardId());
if (slice == null) {
errMessage = "Invalid slice : " + cloudDesc.getShardId();
continue;
}
- if (slice.getReplica(coreNodeName) != null) return;
+ if (slice.getReplica(coreNodeName) != null) {
+ Replica replica = slice.getReplica(coreNodeName);
+ String baseUrl = replica.getStr(BASE_URL_PROP);
+ String coreName = replica.getStr(CORE_NAME_PROP);
+ if (baseUrl.equals(this.baseURL) && coreName.equals(cd.getName())) {
+ return;
+ } else {
+ errMessage = "replica with coreNodeName " + coreNodeName + " exists but with a different name or base_url";
+ }
+ }
+ Thread.sleep(100);
+ }
+ if (errMessage == null) {
+ errMessage = "replica " + coreNodeName + " is not present in cluster state";
}
- if(errMessage == null) errMessage = " no_such_replica in clusterstate ,replicaName : " + coreNodeName;
- throw new SolrException(ErrorCode.SERVER_ERROR,errMessage + "state : "+ zkStateReader.getClusterState().getCollection(cd.getCollectionName()));
+ throw new SolrException(ErrorCode.SERVER_ERROR, errMessage + ". state : "+ zkStateReader.getClusterState().getCollection(cd.getCollectionName()));
}
}