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 ma...@apache.org on 2010/02/11 16:03:44 UTC

svn commit: r909012 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/cloud/ZkController.java test/org/apache/solr/cloud/AbstractZkTestCase.java test/org/apache/solr/cloud/BasicDistributedZkTest.java

Author: markrmiller
Date: Thu Feb 11 15:03:43 2010
New Revision: 909012

URL: http://svn.apache.org/viewvc?rev=909012&view=rev
Log:
fix up issue with making collection shard watch

Modified:
    lucene/solr/branches/cloud/src/java/org/apache/solr/cloud/ZkController.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

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=909012&r1=909011&r2=909012&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 Thu Feb 11 15:03:43 2010
@@ -695,8 +695,10 @@
     Set<String> knownCollections = cloudState.getCollections();
     
     List<String> collections = zkClient.getChildren(COLLECTIONS_ZKNODE, null);
+
     for(final String collection : collections) {
       if(!knownCollections.contains(collection)) {
+        log.info("Found new collection:" + collection);
         Watcher watcher = new Watcher() {
           public void process(WatchedEvent event) {
             log.info("Detected changed ShardId in collection:" + collection);
@@ -721,25 +723,23 @@
           }
         };
         boolean madeWatch = true;
-
+        String shardZkNode = COLLECTIONS_ZKNODE + "/" + collection
+            + SHARDS_ZKNODE;
         for (int i = 0; i < 5; i++) {
           try {
-            zkClient.getChildren(COLLECTIONS_ZKNODE + "/" + collection
-                + SHARDS_ZKNODE, watcher);
+            zkClient.getChildren(shardZkNode, watcher);
           } catch (KeeperException.NoNodeException e) {
             // most likely, the collections node has been created, but not the
             // shards node yet -- pause and try again
             madeWatch = false;
             if (i == 4) {
-              // nocommit : 
-//              throw new ZooKeeperException(
-//                  SolrException.ErrorCode.SERVER_ERROR,
-//                  "Could not set shards zknode watch, because the zknode does not exist");
-            break;
+              log.error("Could not set shards zknode watch, because the zknode does not exist:" + shardZkNode);
+              break;
             }
-            Thread.sleep(50);
+            Thread.sleep(100);
           }
-          if(madeWatch) {
+          if (madeWatch) {
+            log.info("Made shard watch:" + shardZkNode);
             break;
           }
         }

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/AbstractZkTestCase.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/AbstractZkTestCase.java?rev=909012&r1=909011&r2=909012&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/AbstractZkTestCase.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/AbstractZkTestCase.java Thu Feb 11 15:03:43 2010
@@ -109,10 +109,6 @@
     props1.put("configName", "conf1");
     zkClient.makePath("/collections/collection1", props1.store(), CreateMode.PERSISTENT);
     
-    ZkNodeProps props2 = new ZkNodeProps();
-    props2.put("configName", "conf1");
-    zkClient.makePath("/collections/testcore", props2.store(), CreateMode.PERSISTENT);
-    
     putConfig(zkClient, config);
     putConfig(zkClient, schema);
     putConfig(zkClient, "stopwords.txt");

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=909012&r1=909011&r2=909012&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Thu Feb 11 15:03:43 2010
@@ -152,14 +152,6 @@
       query("q","*:*", "sort",f+" desc");
       query("q","*:*", "sort",f+" asc");
     }
-
-    /**
-    h.getCoreContainer().getCore(h.getCoreContainer().getDefaultCoreName()).close();
-    CoreDescriptor dcore= new CoreDescriptor( h.getCoreContainer(), "testcore", "testcore");
-
-    SolrCore core = h.getCoreContainer().create(dcore);
-    h.getCoreContainer().register(core, false);
-    **/
   
     // these queries should be exactly ordered and scores should exactly match
     query("q","*:*", "sort",i1+" desc");