lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r901346 - in /lucene/solr/branches/cloud/src: java/org/apache/solr/cloud/ test/org/apache/solr/cloud/ test/test-files/solr/
Date Wed, 20 Jan 2010 19:35:17 GMT
Author: markrmiller
Date: Wed Jan 20 19:35:17 2010
New Revision: 901346

URL: http://svn.apache.org/viewvc?rev=901346&view=rev
Log:
more test work

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/BasicZkTest.java
    lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/DistributedZkFailuresTest.java
    lucene/solr/branches/cloud/src/test/test-files/solr/solr.lowZkTimeout.xml

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=901346&r1=901345&r2=901346&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 Wed Jan 20
19:35:17 2010
@@ -384,10 +384,20 @@
   private void createEphemeralNode() throws KeeperException,
       InterruptedException {
     String nodeName = getNodeName();
-    zkClient.makePath(NODES_ZKNODE + "/" + nodeName, CreateMode.EPHEMERAL);
+    String nodePath = NODES_ZKNODE + "/" + nodeName;
+    log.info("Register node as live in ZooKeeper:" + nodePath);
+    try {
+      zkClient.makePath(nodePath, CreateMode.EPHEMERAL);
+    } catch (KeeperException e) {
+      // its okay if the node already exists
+      if (e.code() != KeeperException.Code.NODEEXISTS) {
+        throw e;
+      }
+    }
   }
   
-  private String getNodeName() {
+  // package private for tests
+  String getNodeName() {
     return hostName + ":" + localHostPort + "_"+ localHostContext;
   }
 

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=901346&r1=901345&r2=901346&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 Wed
Jan 20 19:35:17 2010
@@ -104,6 +104,7 @@
 
     zkClient = new SolrZkClient(ZOO_KEEPER_ADDRESS, AbstractZkTestCase.TIMEOUT);
     
+    // nocommit : test should work with or without this as we ony have one config
     //zkClient.makePath("/collections/collection1/config=collection1");
 
     putConfig(zkClient, config);

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicZkTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicZkTest.java?rev=901346&r1=901345&r2=901346&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicZkTest.java (original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/BasicZkTest.java Wed Jan 20
19:35:17 2010
@@ -29,6 +29,8 @@
     // test using ZooKeeper
     assertTrue("Not using ZooKeeper", h.getCoreContainer().isZooKeeperAware());
     
+    ZkController zkController = h.getCoreContainer().getZooKeeperController();
+    
     // test merge factor picked up
     SolrCore core = h.getCore();
     SolrIndexWriter writer = new SolrIndexWriter("testWriter", core
@@ -83,11 +85,15 @@
     
     zkServer.shutdown();
     Thread.sleep(300);
-    // try a reconnect
+    
+    // try a reconnect from disconnect
     
     zkServer = new ZkTestServer(zkDir);
     zkServer.run();
     
+    // ensure zk still thinks node is up
+    assertTrue(zkController.getCloudState().liveNodesContain(zkController.getNodeName()));
+    
     // test maxint
     assertQ(req("q", "id:[100 TO 110]", "rows", "2147483647"),
         "//*[@numFound='4']");

Modified: lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/DistributedZkFailuresTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/DistributedZkFailuresTest.java?rev=901346&r1=901345&r2=901346&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/DistributedZkFailuresTest.java
(original)
+++ lucene/solr/branches/cloud/src/test/org/apache/solr/cloud/DistributedZkFailuresTest.java
Wed Jan 20 19:35:17 2010
@@ -101,15 +101,20 @@
 
   @Override
   public void doTest() throws Exception {
+    ZkController zkController = h.getCoreContainer().getZooKeeperController();
     del("*:*");
     
     // nocommit : test too long
     System.out.println("gc block");
-    for(int i = 0; i < 400; i++) {
+    for(int i = 0; i < 100; i++) {
       // try and timeout
       System.gc();
     }
     System.out.println("done gc block");
+    
+    // ensure zk still thinks node is up
+    assertTrue(zkController.getCloudState().liveNodesContain(zkController.getNodeName()));
+    
     // index the same document to two servers and make sure things
     // don't blow up.
     if (clients.size()>=2) {
@@ -123,6 +128,5 @@
       query("q","*:*", "rows",100);
     }
 
-    //Thread.sleep(10000000000L);
   }
 }

Modified: lucene/solr/branches/cloud/src/test/test-files/solr/solr.lowZkTimeout.xml
URL: http://svn.apache.org/viewvc/lucene/solr/branches/cloud/src/test/test-files/solr/solr.lowZkTimeout.xml?rev=901346&r1=901345&r2=901346&view=diff
==============================================================================
--- lucene/solr/branches/cloud/src/test/test-files/solr/solr.lowZkTimeout.xml (original)
+++ lucene/solr/branches/cloud/src/test/test-files/solr/solr.lowZkTimeout.xml Wed Jan 20 19:35:17
2010
@@ -28,7 +28,7 @@
   adminPath: RequestHandler path to manage cores.  
     If 'null' (or absent), cores will not be manageable via request handler
   -->
-  <cores adminPath="/admin/cores" defaultCoreName="collection1" hostContext="solr" zkClientTimeout="30">
+  <cores adminPath="/admin/cores" defaultCoreName="collection1" hostContext="solr" zkClientTimeout="5">
     <core name="collection1" instanceDir="." shardId="shard1"/>
   </cores>
 </solr>



Mime
View raw message