mirror of https://github.com/apache/lucene.git
SOLR-5509: Do not retry to yourself.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1546286 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
301d7a080a
commit
8ed8d46efe
|
@ -360,12 +360,14 @@ public class SolrCmdDistributor {
|
|||
private ZkStateReader zkStateReader;
|
||||
private String collection;
|
||||
private String shardId;
|
||||
private String fromAddress;
|
||||
|
||||
public RetryNode(ZkCoreNodeProps nodeProps, ZkStateReader zkStateReader, String collection, String shardId) {
|
||||
public RetryNode(ZkCoreNodeProps nodeProps, ZkStateReader zkStateReader, String collection, String shardId, String fromCoreUrl) {
|
||||
super(nodeProps);
|
||||
this.zkStateReader = zkStateReader;
|
||||
this.collection = collection;
|
||||
this.shardId = shardId;
|
||||
this.fromAddress = fromCoreUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -382,7 +384,11 @@ public class SolrCmdDistributor {
|
|||
log.warn(null, e);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (fromAddress.equals(leaderProps.getCoreUrl())) {
|
||||
// we became the leader
|
||||
return false;
|
||||
}
|
||||
this.nodeProps = leaderProps;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -298,7 +298,8 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
|
|||
} else {
|
||||
// I need to forward onto the leader...
|
||||
nodes = new ArrayList<Node>(1);
|
||||
nodes.add(new RetryNode(new ZkCoreNodeProps(leaderReplica), zkController.getZkStateReader(), collection, shardId));
|
||||
nodes.add(new RetryNode(new ZkCoreNodeProps(leaderReplica), zkController.getZkStateReader(), collection, shardId, ZkCoreNodeProps.getCoreUrl(
|
||||
zkController.getBaseUrl(), req.getCore().getName())));
|
||||
forwardToLeader = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
|
|||
|
||||
final AtomicInteger retries = new AtomicInteger();
|
||||
ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient1.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1") {
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1", "locahost") {
|
||||
@Override
|
||||
public boolean checkRetry() {
|
||||
retries.incrementAndGet();
|
||||
|
@ -367,7 +367,7 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
|
|||
|
||||
final AtomicInteger retries = new AtomicInteger();
|
||||
nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1") {
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1", "locahost") {
|
||||
@Override
|
||||
public boolean checkRetry() {
|
||||
ss.setExp(null);
|
||||
|
@ -413,7 +413,7 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
|
|||
|
||||
final AtomicInteger retries = new AtomicInteger();
|
||||
nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient.getBaseURL(), ZkStateReader.CORE_NAME_PROP, "");
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1") {
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1", "locahost") {
|
||||
@Override
|
||||
public boolean checkRetry() {
|
||||
retries.incrementAndGet();
|
||||
|
@ -457,7 +457,7 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
|
|||
ArrayList<Node> nodes = new ArrayList<Node>();
|
||||
|
||||
ZkNodeProps nodeProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, "[ff01::114]:33332" + context, ZkStateReader.CORE_NAME_PROP, "");
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1") {
|
||||
RetryNode retryNode = new RetryNode(new ZkCoreNodeProps(nodeProps), null, "collection1", "shard1", "locahost") {
|
||||
@Override
|
||||
public boolean checkRetry() {
|
||||
ZkNodeProps leaderProps = new ZkNodeProps(ZkStateReader.BASE_URL_PROP, solrclient.getBaseURL(),
|
||||
|
|
Loading…
Reference in New Issue