SOLR-3180: update node props for retry node, not just url

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1427657 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-01-02 05:23:11 +00:00
parent 9fb47ac8ed
commit 768728834f
2 changed files with 21 additions and 26 deletions

View File

@ -450,26 +450,20 @@ public class SolrCmdDistributor {
}
public static class StdNode extends Node {
protected String url;
protected String baseUrl;
protected String coreName;
private ZkCoreNodeProps nodeProps;
protected ZkCoreNodeProps nodeProps;
public StdNode(ZkCoreNodeProps nodeProps) {
this.url = nodeProps.getCoreUrl();
this.baseUrl = nodeProps.getBaseUrl();
this.coreName = nodeProps.getCoreName();
this.nodeProps = nodeProps;
}
@Override
public String getUrl() {
return url;
return nodeProps.getCoreUrl();
}
@Override
public String toString() {
return this.getClass().getSimpleName() + ": " + url;
return this.getClass().getSimpleName() + ": " + nodeProps.getCoreUrl();
}
@Override
@ -479,18 +473,21 @@ public class SolrCmdDistributor {
@Override
public String getBaseUrl() {
return baseUrl;
return nodeProps.getBaseUrl();
}
@Override
public String getCoreName() {
return coreName;
return nodeProps.getCoreName();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
String baseUrl = nodeProps.getBaseUrl();
String coreName = nodeProps.getCoreName();
String url = nodeProps.getCoreUrl();
result = prime * result + ((baseUrl == null) ? 0 : baseUrl.hashCode());
result = prime * result + ((coreName == null) ? 0 : coreName.hashCode());
result = prime * result + ((url == null) ? 0 : url.hashCode());
@ -503,15 +500,18 @@ public class SolrCmdDistributor {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
StdNode other = (StdNode) obj;
String baseUrl = nodeProps.getBaseUrl();
String coreName = nodeProps.getCoreName();
String url = nodeProps.getCoreUrl();
if (baseUrl == null) {
if (other.baseUrl != null) return false;
} else if (!baseUrl.equals(other.baseUrl)) return false;
if (other.nodeProps.getBaseUrl() != null) return false;
} else if (!baseUrl.equals(other.nodeProps.getBaseUrl())) return false;
if (coreName == null) {
if (other.coreName != null) return false;
} else if (!coreName.equals(other.coreName)) return false;
if (other.nodeProps.getCoreName() != null) return false;
} else if (!coreName.equals(other.nodeProps.getCoreName())) return false;
if (url == null) {
if (other.url != null) return false;
} else if (!url.equals(other.url)) return false;
if (other.nodeProps.getCoreUrl() != null) return false;
} else if (!url.equals(other.nodeProps.getCoreUrl())) return false;
return true;
}

View File

@ -1117,11 +1117,6 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
this.collection = collection;
this.shardId = shardId;
}
@Override
public String toString() {
return url;
}
@Override
public boolean checkRetry() {
@ -1134,7 +1129,7 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
return false;
}
this.url = leaderProps.getCoreUrl();
this.nodeProps = leaderProps;
return true;
}
@ -1155,9 +1150,9 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
if (!super.equals(obj)) return false;
if (getClass() != obj.getClass()) return false;
RetryNode other = (RetryNode) obj;
if (url == null) {
if (other.url != null) return false;
} else if (!url.equals(other.url)) return false;
if (nodeProps.getCoreUrl() == null) {
if (other.nodeProps.getCoreUrl() != null) return false;
} else if (!nodeProps.getCoreUrl().equals(other.nodeProps.getCoreUrl())) return false;
return true;
}