You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2009/12/12 23:22:17 UTC

svn commit: r889992 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/core/ZooKeeperController.java java/org/apache/solr/util/ZooPut.java test/org/apache/solr/AbstractZooKeeperTestCase.java

Author: yonik
Date: Sat Dec 12 22:22:16 2009
New Revision: 889992

URL: http://svn.apache.org/viewvc?rev=889992&view=rev
Log:
hack around async readiness of zk client

Modified:
    lucene/solr/branches/cloud/src/java/org/apache/solr/core/ZooKeeperController.java
    lucene/solr/branches/cloud/src/java/org/apache/solr/util/ZooPut.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/AbstractZooKeeperTestCase.java

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/core/ZooKeeperController.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/core/ZooKeeperController.java?rev=889992&r1=889991&r2=889992&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/core/ZooKeeperController.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/core/ZooKeeperController.java Sat Dec 12 22:22:16 2009
@@ -45,6 +45,11 @@
     this.collectionName = collection;
     try {
       keeper = new ZooKeeper(zookeeperHost, 10000, this);
+
+      // TODO
+      log.warn("TODO: remove sleep that waits for zookeeper client");
+      try {Thread.sleep(200);} catch (InterruptedException e) {e.printStackTrace();}
+
       loadConfigPath();
       register();
     } catch (IOException e) {

Modified: lucene/solr/branches/cloud/src/java/org/apache/solr/util/ZooPut.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/java/org/apache/solr/util/ZooPut.java?rev=889992&r1=889991&r2=889992&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/java/org/apache/solr/util/ZooPut.java (original)
+++ lucene/solr/branches/cloud/src/java/org/apache/solr/util/ZooPut.java Sat Dec 12 22:22:16 2009
@@ -21,6 +21,7 @@
 
   public ZooPut(String host) throws IOException {
     keeper = new ZooKeeper(host, 10000, null);
+    // TODO: this is asynchronous - think about how to deal with connection lost, and other failures
   }
 
   public ZooPut(ZooKeeper keeper) throws IOException {

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/AbstractZooKeeperTestCase.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/AbstractZooKeeperTestCase.java?rev=889992&r1=889991&r2=889992&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/AbstractZooKeeperTestCase.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/AbstractZooKeeperTestCase.java Sat Dec 12 22:22:16 2009
@@ -53,15 +53,18 @@
 
         try {
           zkServer.runFromConfig(config);
-        } catch (IOException e) {
+          log.info("ZOOKEEPER EXIT");
+        } catch (Throwable e) {          
+          e.printStackTrace();
           throw new RuntimeException(e);
         }
-
       }
     };
+    
     zooThread.setDaemon(true);
     zooThread.start();
     Thread.sleep(500); // pause for ZooKeeper to start
+
     buildZooKeeper(getSolrConfigFile(), getSchemaFile());
 
     log.info("####SETUP_START " + getName());
@@ -86,10 +89,12 @@
 
   public static void buildZooKeeper(String config, String schema) throws Exception {
     ZooPut zooPut = new ZooPut(ZOO_KEEPER_HOST.substring(0, ZOO_KEEPER_HOST.indexOf('/')));
+    Thread.sleep(200);  // TODO: ZooPut creation is currently async
     zooPut.makePath("/solr");
     zooPut.close();
     
     zooPut = new ZooPut(ZOO_KEEPER_HOST);
+    Thread.sleep(200);  // TODO: ZooPut creation is currently async
     
     zooPut.makePath("/collections/collection1/config=collection1");