From 8c91459f5bef82e1cfaccb613b401ac3a72cd63c Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Wed, 19 Dec 2012 18:12:36 +0000 Subject: [PATCH] raise timeouts for wait to see state and get assigned shard id git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1423993 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/solr/cloud/ZkController.java | 4 ++-- .../apache/solr/handler/admin/CoreAdminHandler.java | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java index 68fa6495741..3bcd3b95108 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java @@ -1062,7 +1062,7 @@ public final class ZkController { private String doGetShardIdProcess(String coreName, CloudDescriptor descriptor) { final String shardZkNodeName = getNodeName() + "_" + coreName; - int retryCount = 120; + int retryCount = 320; while (retryCount-- > 0) { final String shardId = zkStateReader.getClusterState().getShardId( shardZkNodeName); @@ -1070,7 +1070,7 @@ public final class ZkController { return shardId; } try { - Thread.sleep(500); + Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java index ee2ce83809d..48ca1e44c34 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java @@ -868,7 +868,7 @@ public class CoreAdminHandler extends RequestHandlerBase { } protected void handleWaitForStateAction(SolrQueryRequest req, - SolrQueryResponse rsp) throws IOException, InterruptedException { + SolrQueryResponse rsp) throws IOException, InterruptedException, KeeperException { final SolrParams params = req.getParams(); String cname = params.get(CoreAdminParams.CORE); @@ -904,6 +904,12 @@ public class CoreAdminHandler extends RequestHandlerBase { // to accept updates CloudDescriptor cloudDescriptor = core.getCoreDescriptor() .getCloudDescriptor(); + + if (retry == 15 || retry == 60) { + // force a cluster state update + coreContainer.getZkController().getZkStateReader().updateClusterState(true); + } + ClusterState clusterState = coreContainer.getZkController() .getClusterState(); String collection = cloudDescriptor.getCollectionName(); @@ -927,11 +933,11 @@ public class CoreAdminHandler extends RequestHandlerBase { } } - if (retry++ == 30) { + if (retry++ == 120) { throw new SolrException(ErrorCode.BAD_REQUEST, "I was asked to wait on state " + waitForState + " for " + nodeName - + " but I still do not see the request state. I see state: " + + " but I still do not see the requested state. I see state: " + state + " live:" + live); }