You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2014/06/24 18:47:53 UTC
svn commit: r1605134 - in /lucene/dev/trunk/solr: CHANGES.txt
core/src/java/org/apache/solr/cloud/ZkController.java
core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
Author: thelabdude
Date: Tue Jun 24 16:47:53 2014
New Revision: 1605134
URL: http://svn.apache.org/r1605134
Log:
SOLR-6189: Don't publish the state as down if the node is not live when determining if a replica should be in leader-initiated recovery.
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1605134&r1=1605133&r2=1605134&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Jun 24 16:47:53 2014
@@ -96,6 +96,9 @@ Bug Fixes
* SOLR-6165: DataImportHandler should write BigInteger and BigDecimal values as strings.
(Anand Sengamalai via shalin)
+
+* SOLR-6189: Avoid publishing the state as down if the node is not live when determining
+ if a replica should be in leader-initiated recovery. (Timothy Potter)
Other Changes
---------------------
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1605134&r1=1605133&r2=1605134&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java Tue Jun 24 16:47:53 2014
@@ -1776,9 +1776,11 @@ public final class ZkController {
// about the same replica having trouble and we only need to send the "needs"
// recovery signal once
boolean nodeIsLive = true;
+ boolean publishDownState = false;
synchronized (replicasInLeaderInitiatedRecovery) {
if (replicasInLeaderInitiatedRecovery.containsKey(replicaUrl)) {
if (!forcePublishState) {
+ log.debug("Replica {} already in leader-initiated recovery handling.", replicaUrl);
return false; // already in this recovery process
}
}
@@ -1794,22 +1796,32 @@ public final class ZkController {
getLeaderInitiatedRecoveryZnodePath(collection, shardId, replicaCoreName));
// create a znode that requires the replica needs to "ack" to verify it knows it was out-of-sync
updateLeaderInitiatedRecoveryState(collection, shardId, replicaCoreName, ZkStateReader.DOWN);
+ log.info("Put replica "+replicaCoreName+" on "+
+ replicaNodeName+" into leader-initiated recovery.");
+ publishDownState = true;
} else {
nodeIsLive = false; // we really don't need to send the recovery request if the node is NOT live
+ log.info("Node "+replicaNodeName+
+ " is not live, so skipping leader-initiated recovery for replica: "+
+ replicaCoreName);
+ // publishDownState will be false to avoid publishing the "down" state too many times
+ // as many errors can occur together and will each call into this method (SOLR-6189)
}
}
- String replicaCoreName = replicaCoreProps.getCoreName();
- ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, "state",
- ZkStateReader.STATE_PROP, ZkStateReader.DOWN,
- ZkStateReader.BASE_URL_PROP, replicaCoreProps.getBaseUrl(),
- ZkStateReader.CORE_NAME_PROP, replicaCoreProps.getCoreName(),
- ZkStateReader.NODE_NAME_PROP, replicaCoreProps.getNodeName(),
- ZkStateReader.SHARD_ID_PROP, shardId,
- ZkStateReader.COLLECTION_PROP, collection);
- log.warn("Leader is publishing core={} state={} on behalf of un-reachable replica {}; forcePublishState? "+forcePublishState,
- replicaCoreName, ZkStateReader.DOWN, replicaUrl);
- overseerJobQueue.offer(ZkStateReader.toJSON(m));
+ if (publishDownState || forcePublishState) {
+ String replicaCoreName = replicaCoreProps.getCoreName();
+ ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, "state",
+ ZkStateReader.STATE_PROP, ZkStateReader.DOWN,
+ ZkStateReader.BASE_URL_PROP, replicaCoreProps.getBaseUrl(),
+ ZkStateReader.CORE_NAME_PROP, replicaCoreProps.getCoreName(),
+ ZkStateReader.NODE_NAME_PROP, replicaCoreProps.getNodeName(),
+ ZkStateReader.SHARD_ID_PROP, shardId,
+ ZkStateReader.COLLECTION_PROP, collection);
+ log.warn("Leader is publishing core={} state={} on behalf of un-reachable replica {}; forcePublishState? "+forcePublishState,
+ replicaCoreName, ZkStateReader.DOWN, replicaUrl);
+ overseerJobQueue.offer(ZkStateReader.toJSON(m));
+ }
return nodeIsLive;
}
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java?rev=1605134&r1=1605133&r2=1605134&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java Tue Jun 24 16:47:53 2014
@@ -79,13 +79,7 @@ public class HttpPartitionTest extends A
@Override
@After
- public void tearDown() throws Exception {
- if (!proxies.isEmpty()) {
- for (SocketProxy proxy : proxies.values()) {
- proxy.close();
- }
- }
-
+ public void tearDown() throws Exception {
System.clearProperty("numShards");
try {
@@ -93,6 +87,13 @@ public class HttpPartitionTest extends A
} catch (Exception exc) {}
resetExceptionIgnores();
+
+ // close socket proxies after super.tearDown
+ if (!proxies.isEmpty()) {
+ for (SocketProxy proxy : proxies.values()) {
+ proxy.close();
+ }
+ }
}
/**