SOLR-5770: All attempts to match a SolrCore with it's state in clusterstate.json should be done with the CoreNodeName.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1571349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2014-02-24 17:04:16 +00:00
parent 95c23d4b00
commit c408c5258e
3 changed files with 11 additions and 8 deletions

View File

@ -401,6 +401,9 @@ Bug Fixes
* SOLR-5448: ShowFileRequestHandler treats everything as Directory, when in
Cloud-Mode. (Erick Erickson, steffkes)
* SOLR-5770: All attempts to match a SolrCore with it's state in clusterstate.json
should be done with the CoreNodeName. (Steve Davids via Mark Miller)
Optimizations
----------------------

View File

@ -1049,7 +1049,7 @@ public final class ZkController {
final CloudDescriptor cloudDesc = desc.getCloudDescriptor();
final String shardId = state.getShardId(getBaseUrl(), desc.getName());
final String shardId = state.getShardId(getNodeName(), desc.getName());
if (shardId != null) {
cloudDesc.setShardId(shardId);
@ -1256,13 +1256,13 @@ public final class ZkController {
for (Replica replica : slice.getReplicas()) {
// TODO: for really large clusters, we could 'index' on this
String baseUrl = replica.getStr(ZkStateReader.BASE_URL_PROP);
String nodeName = replica.getStr(ZkStateReader.NODE_NAME_PROP);
String core = replica.getStr(ZkStateReader.CORE_NAME_PROP);
String msgBaseUrl = getBaseUrl();
String msgNodeName = getNodeName();
String msgCore = descriptor.getName();
if (baseUrl.equals(msgBaseUrl) && core.equals(msgCore)) {
if (nodeName.equals(msgNodeName) && core.equals(msgCore)) {
descriptor.getCloudDescriptor()
.setCoreNodeName(replica.getName());
return;
@ -1282,7 +1282,7 @@ public final class ZkController {
log.info("waiting to find shard id in clusterstate for " + cd.getName());
int retryCount = 320;
while (retryCount-- > 0) {
final String shardId = zkStateReader.getClusterState().getShardId(getBaseUrl(), cd.getName());
final String shardId = zkStateReader.getClusterState().getShardId(getNodeName(), cd.getName());
if (shardId != null) {
cd.getCloudDescriptor().setShardId(shardId);
return;

View File

@ -199,15 +199,15 @@ public class ClusterState implements JSONWriter.Writable {
return Collections.unmodifiableSet(liveNodes);
}
public String getShardId(String baseUrl, String coreName) {
public String getShardId(String nodeName, String coreName) {
// System.out.println("###### getShardId(" + baseUrl + "," + coreName + ") in " + collectionStates);
for (DocCollection coll : collectionStates.values()) {
for (Slice slice : coll.getSlices()) {
for (Replica replica : slice.getReplicas()) {
// TODO: for really large clusters, we could 'index' on this
String rbaseUrl = replica.getStr(ZkStateReader.BASE_URL_PROP);
String rnodeName = replica.getStr(ZkStateReader.NODE_NAME_PROP);
String rcore = replica.getStr(ZkStateReader.CORE_NAME_PROP);
if (baseUrl.equals(rbaseUrl) && coreName.equals(rcore)) {
if (nodeName.equals(rnodeName) && coreName.equals(rcore)) {
return slice.getName();
}
}