hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1005691 - in /hbase/trunk/src: main/java/org/apache/hadoop/hbase/client/HConnectionManager.java main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java test/java/org/apache/hadoop/hbase/TestZooKeeper.java
Date Fri, 08 Oct 2010 01:13:55 GMT
Author: stack
Date: Fri Oct  8 01:13:55 2010
New Revision: 1005691

URL: http://svn.apache.org/viewvc?rev=1005691&view=rev
Log:
HBASE-3074 Zookeeper test failing on hudson

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1005691&r1=1005690&r2=1005691&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Fri Oct
 8 01:13:55 2010
@@ -515,7 +515,8 @@ public class HConnectionManager {
 
     private HRegionLocation locateRegion(final byte [] tableName,
       final byte [] row, boolean useCache)
-    throws IOException{
+    throws IOException {
+      if (this.closed) throw new IOException("closed");
       if (tableName == null || tableName.length == 0) {
         throw new IllegalArgumentException(
             "table name cannot be null or zero length");
@@ -525,7 +526,8 @@ public class HConnectionManager {
         try {
           HServerAddress hsa =
             this.rootRegionTracker.waitRootRegionLocation(this.rpcTimeout);
-          LOG.debug("Lookedup root region location with hcm=" + this + "; " + hsa);
+          LOG.debug("Lookedup root region location, connection=" + this +
+            "; hsa=" + hsa);
           if (hsa == null) return null;
           return new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, hsa);
         } catch (InterruptedException e) {
@@ -1030,6 +1032,7 @@ public class HConnectionManager {
         this.zooKeeper.close();
         this.zooKeeper = null;
       }
+      this.closed = true;
     }
 
     private Callable<MultiResponse> createCallable(
@@ -1289,6 +1292,7 @@ public class HConnectionManager {
     public void abort(final String msg, Throwable t) {
       if (t != null) LOG.fatal(msg, t);
       else LOG.fatal(msg);
+      this.closed = true;
     }
   }
 }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java?rev=1005691&r1=1005690&r2=1005691&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java Fri
Oct  8 01:13:55 2010
@@ -249,10 +249,13 @@ public class ZooKeeperWatcher implements
       case Disconnected:
         LOG.info(prefix("Received Disconnected from ZooKeeper, ignoring"));
         break;
+
       case Expired:
-        String msg = prefix("Received Expired from ZooKeeper, aborting server");
-        LOG.error(msg);
-        if (abortable != null) abortable.abort(msg, null);
+        String msg = prefix(this.identifier + " received expired from " +
+          "ZooKeeper, aborting");
+        // TODO: One thought is to add call to ZooKeeperListener so say,
+        // ZooKeperNodeTracker can zero out its data values.
+        if (this.abortable != null) this.abortable.abort(msg, null);
         break;
     }
   }

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java?rev=1005691&r1=1005690&r2=1005691&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java Fri Oct  8 01:13:55
2010
@@ -40,8 +40,12 @@ import org.apache.hadoop.hbase.zookeeper
 import org.apache.hadoop.hbase.zookeeper.ZKUtil;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooKeeper.States;
+import org.apache.zookeeper.proto.WatcherEvent;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -90,11 +94,11 @@ public class TestZooKeeper {
   @Test
   public void testClientSessionExpired()
       throws IOException, InterruptedException {
-    new HTable(conf, HConstants.META_TABLE_NAME);
-
-    String quorumServers = ZKConfig.getZKQuorumServersString(conf);
+    Configuration c = new Configuration(this.conf);
+    new HTable(c, HConstants.META_TABLE_NAME);
+    String quorumServers = ZKConfig.getZKQuorumServersString(c);
     int sessionTimeout = 5 * 1000; // 5 seconds
-    HConnection connection = HConnectionManager.getConnection(conf);
+    HConnection connection = HConnectionManager.getConnection(c);
     ZooKeeperWatcher connectionZK = connection.getZooKeeperWatcher();
     long sessionID = connectionZK.getZooKeeper().getSessionId();
     byte[] password = connectionZK.getZooKeeper().getSessionPasswd();
@@ -106,7 +110,8 @@ public class TestZooKeeper {
     Thread.sleep(sessionTimeout * 3L);
 
     System.err.println("ZooKeeper should have timed out");
-    connection.relocateRegion(HConstants.ROOT_TABLE_NAME, HConstants.EMPTY_BYTE_ARRAY);
+    Assert.assertTrue(connection.getZooKeeperWatcher().getZooKeeper().
+      getState().equals(States.CLOSED));
   }
   
   @Test



Mime
View raw message