Skip to content

Apache Lucene open-source search software

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

Mark Robert Miller768728834f56
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index 652025dcfcb..8c7e4615583 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -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;
}
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
index 0e993119fef..5a326a384c0 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
@@ -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;
}