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/10/13 17:48:44 UTC
svn commit: r1631442 - in /lucene/dev/branches/branch_5x/solr: CHANGES.txt
core/src/java/org/apache/solr/cloud/ZkController.java
core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
Author: thelabdude
Date: Mon Oct 13 15:48:43 2014
New Revision: 1631442
URL: http://svn.apache.org/r1631442
Log:
SOLR-6592: Avoid waiting for the leader to see the down state if that leader is not live.
Modified:
lucene/dev/branches/branch_5x/solr/CHANGES.txt
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1631442&r1=1631441&r2=1631442&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Mon Oct 13 15:48:43 2014
@@ -276,6 +276,9 @@ Other Changes
* SOLR-5852: Add CloudSolrServer helper method to connect to a ZK ensemble. (Varun Thacker, Furkan KAMACI,
Shawn Heisey, Mark Miller, Erick Erickson via shalin)
+* SOLR-6592: Avoid waiting for the leader to see the down state if that leader is not live.
+ (Timothy Potter)
+
================== 4.10.1 ==================
Bug Fixes
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1631442&r1=1631441&r2=1631442&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/ZkController.java Mon Oct 13 15:48:43 2014
@@ -20,8 +20,11 @@ package org.apache.solr.cloud;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.ConnectException;
import java.net.InetAddress;
import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.ArrayList;
@@ -42,6 +45,8 @@ import java.util.concurrent.TimeoutExcep
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.http.NoHttpResponseException;
+import org.apache.http.conn.ConnectTimeoutException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.request.CoreAdminRequest.WaitForState;
import org.apache.solr.common.SolrException;
@@ -1626,6 +1631,23 @@ public final class ZkController {
server.request(prepCmd);
break;
} catch (Exception e) {
+
+ // if the core container is shutdown, don't wait
+ if (cc.isShutDown()) {
+ throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
+ "Core container is shutdown.");
+ }
+
+ Throwable rootCause = SolrException.getRootCause(e);
+ if (rootCause instanceof IOException) {
+ // if there was a communication error talking to the leader, see if the leader is even alive
+ if (!zkStateReader.getClusterState().liveNodesContain(leaderProps.getNodeName())) {
+ throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
+ "Node "+leaderProps.getNodeName()+" hosting leader for "+
+ shard+" in "+collection+" is not live!");
+ }
+ }
+
SolrException.log(log,
"There was a problem making a request to the leader", e);
try {
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java?rev=1631442&r1=1631441&r2=1631442&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java Mon Oct 13 15:48:43 2014
@@ -117,6 +117,10 @@ public class HttpPartitionTest extends A
// have the leader lose its Zk session temporarily
testLeaderZkSessionLoss();
+
+ waitForThingsToLevelOut(30000);
+
+ log.info("HttpParitionTest succeeded ... shutting down now!");
}
protected void testRf2() throws Exception {
@@ -187,6 +191,8 @@ public class HttpPartitionTest extends A
// verify all docs received
assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, numDocs + 3);
+ log.info("testRf2 succeeded ... deleting the "+testCollectionName+" collection");
+
// try to clean up
try {
CollectionAdminRequest req = new CollectionAdminRequest.Delete();
@@ -240,6 +246,9 @@ public class HttpPartitionTest extends A
sendDoc(4);
assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, 4);
+
+ log.info("testRf3 succeeded ... deleting the "+testCollectionName+" collection");
+
// try to clean up
try {
CollectionAdminRequest req = new CollectionAdminRequest.Delete();
@@ -334,6 +343,8 @@ public class HttpPartitionTest extends A
waitToSeeReplicasActive(testCollectionName, "shard1", replicasToCheck, 20);
assertDocsExistInAllReplicas(participatingReplicas, testCollectionName, 1, 2);
+ log.info("testLeaderZkSessionLoss succeeded ... deleting the "+testCollectionName+" collection");
+
// try to clean up
try {
CollectionAdminRequest req = new CollectionAdminRequest.Delete();