lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r905525 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/cloud/ java/org/apache/solr/core/ test/org/apache/solr/cloud/
Date Tue, 02 Feb 2010 06:19:10 GMT
Author: yonik
Date: Tue Feb  2 06:18:56 2010
New Revision: 905525

URL: http://svn.apache.org/viewvc?rev=905525&view=rev
Log:
add connect timeout to ZkController and make it long for embedded zk ensemble

Modified:
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java?rev=905525&r1=905524&r2=905525&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkClient.java Tue Feb  2
06:18:56 2010
@@ -73,8 +73,8 @@
     this(zkServerAddress, zkClientTimeout, new DefaultConnectionStrategy(), null);
   }
   
-  public SolrZkClient(String zkServerAddress, int zkClientTimeout, OnReconnect onReonnect)
throws InterruptedException, TimeoutException, IOException {
-    this(zkServerAddress, zkClientTimeout, new DefaultConnectionStrategy(), onReonnect);
+  public SolrZkClient(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout,
OnReconnect onReonnect) throws InterruptedException, TimeoutException, IOException {
+    this(zkServerAddress, zkClientTimeout, new DefaultConnectionStrategy(), onReonnect, zkClientConnectTimeout);
   }
 
   /**

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java?rev=905525&r1=905524&r2=905525&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/SolrZkServer.java Tue Feb  2
06:18:56 2010
@@ -27,6 +27,7 @@
 import org.apache.solr.common.SolrException;
 import org.slf4j.LoggerFactory;
 
+import java.util.Collections;
 import java.util.Properties;
 import java.util.Map;
 import java.io.*;
@@ -89,6 +90,10 @@
     }
   }
 
+  public Map<Long, QuorumPeer.QuorumServer> getServers() {
+    return zkProps.getServers();
+  }
+
   public void start() {
     if (zkRun == null) return;
 

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java?rev=905525&r1=905524&r2=905525&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java Tue Feb  2
06:18:56 2010
@@ -113,7 +113,7 @@
    * @throws TimeoutException
    * @throws IOException
    */
-  public ZkController(String zkServerAddress, int zkClientTimeout, String localHost, String
locaHostPort,
+  public ZkController(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout,
String localHost, String locaHostPort,
       String localHostContext, final CoreContainer coreContainer) throws InterruptedException,
       TimeoutException, IOException {
     this.zkServerAddress = zkServerAddress;
@@ -121,7 +121,7 @@
     this.localHostContext = localHostContext;
     this.localHost = localHost;
     cloudState = new CloudState(new HashSet<String>(0), new HashMap<String,Map<String,Slice>>(0));
-    zkClient = new SolrZkClient(zkServerAddress, zkClientTimeout,
+    zkClient = new SolrZkClient(zkServerAddress, zkClientTimeout, zkClientConnectTimeout,
         // on reconnect, reload cloud info
         new OnReconnect() {
 

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java?rev=905525&r1=905524&r2=905525&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/core/CoreContainer.java Tue Feb  2
06:18:56 2010
@@ -24,6 +24,7 @@
 import java.util.concurrent.TimeoutException;
 import java.text.SimpleDateFormat;
 
+import org.apache.solr.cloud.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -32,11 +33,6 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 
-import org.apache.solr.cloud.CloudDescriptor;
-import org.apache.solr.cloud.ZkSolrResourceLoader;
-import org.apache.solr.cloud.ZkController;
-import org.apache.solr.cloud.ZooKeeperException;
-import org.apache.solr.cloud.SolrZkServer;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CoreAdminParams;
 import org.apache.solr.common.util.DOMUtil;
@@ -117,12 +113,18 @@
     if (zookeeperHost == null) {
       zookeeperHost = zkServer.getClientString();
     }
-    
+
+    int zkClientConnectTimeout = 5000;
+
     if (zookeeperHost != null) {
       // we are ZooKeeper enabled
       try {
         log.info("Zookeeper client=" + zookeeperHost);
-        zooKeeperController = new ZkController(zookeeperHost, zkClientTimeout, host, hostPort,
hostContext, this);
+        // If this is an ensemble, allow for a long connect time for other servers to come
up
+        if (zkRun != null && zkServer.getServers().size() > 1)
+          zkClientConnectTimeout = 24 * 60 * 60 * 1000;  // 1 day for embedded ensemble
+
+        zooKeeperController = new ZkController(zookeeperHost, zkClientTimeout, zkClientConnectTimeout,
host, hostPort, hostContext, this);
         
         String confDir = System.getProperty("bootstrap_confdir");
         if(confDir != null) {

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java?rev=905525&r1=905524&r2=905525&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/ZkControllerTest.java Tue Feb
 2 06:18:56 2010
@@ -78,7 +78,7 @@
         zkClient.printLayoutToStdOut();
       }
 
-      zkController = new ZkController(AbstractZkTestCase.ZOO_KEEPER_ADDRESS, TIMEOUT, "localhost",
+      zkController = new ZkController(AbstractZkTestCase.ZOO_KEEPER_ADDRESS, TIMEOUT, 1000,
"localhost",
           "8983", "/solr", null);
       zkController.updateCloudState(true);
       CloudState cloudInfo = zkController.getCloudState();
@@ -153,7 +153,7 @@
         zkClient.printLayoutToStdOut();
       }
       zkClient.close();
-      ZkController zkController = new ZkController(AbstractZkTestCase.ZOO_KEEPER_ADDRESS,
TIMEOUT,
+      ZkController zkController = new ZkController(AbstractZkTestCase.ZOO_KEEPER_ADDRESS,
TIMEOUT, 1000,
           "localhost", "8983", "/solr", null);
       try {
         String configName = zkController.readConfigName(COLLECTION_NAME);
@@ -179,7 +179,7 @@
 
       AbstractZkTestCase.makeSolrZkNode();
 
-      zkController = new ZkController(AbstractZkTestCase.ZOO_KEEPER_ADDRESS, TIMEOUT, "localhost",
+      zkController = new ZkController(AbstractZkTestCase.ZOO_KEEPER_ADDRESS, TIMEOUT, 1000,
"localhost",
           "8983", "/solr", null);
 
       zkController.uploadToZK(new File("solr/conf"),



Mime
View raw message