You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2012/08/02 22:11:52 UTC

svn commit: r1368684 - in /hbase/branches/0.92: CHANGES.txt src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java

Author: jmhsieh
Date: Thu Aug  2 20:11:52 2012
New Revision: 1368684

URL: http://svn.apache.org/viewvc?rev=1368684&view=rev
Log:
HBASE-4470 ServerNotRunningException coming out of assignRootAndMeta kills the Master (Gregory Chanan)

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1368684&r1=1368683&r2=1368684&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Thu Aug  2 20:11:52 2012
@@ -97,7 +97,7 @@ Release 0.92.2 - Unreleased
    HBASE-6447  Common TestZooKeeper failures on jenkins: testMasterSessionExpired and testCreateSilentIsReallySilent
    HBASE-6450  HBase startup should be with MALLOC_MAX_ARENA set
    HBASE-6334  TestImprovement for TestHRegion.testWritesWhileGetting (Gregory Chanan)
-
+   HBASE-4470  ServerNotRunningException coming out of assignRootAndMeta kills the Master (Gregory Chanan) 
 
   IMPROVEMENTS
    HBASE-5592  Make it easier to get a table from shell (Ben West)

Modified: hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java?rev=1368684&r1=1368683&r2=1368684&view=diff
==============================================================================
--- hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java (original)
+++ hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java Thu Aug  2 20:11:52 2012
@@ -54,6 +54,7 @@ import org.apache.hadoop.hbase.zookeeper
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.apache.hadoop.util.Progressable;
 import org.apache.zookeeper.KeeperException;
+import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -213,14 +214,7 @@ public class TestCatalogTracker {
     }
   }
 
-  /**
-   * Test we survive a connection refused {@link ConnectException}
-   * @throws IOException
-   * @throws InterruptedException
-   * @throws KeeperException
-   */
-  @Test
-  public void testGetMetaServerConnectionFails()
+  private void testVerifyMetaRegionLocationWithException(Exception ex)
   throws IOException, InterruptedException, KeeperException {
     // Mock an HRegionInterface.
     final HRegionInterface implementation = Mockito.mock(HRegionInterface.class);
@@ -228,7 +222,7 @@ public class TestCatalogTracker {
     try {
       // If a 'get' is called on mocked interface, throw connection refused.
       Mockito.when(implementation.get((byte[]) Mockito.any(), (Get) Mockito.any())).
-        thenThrow(new ConnectException("Connection refused"));
+        thenThrow(ex);
       // Now start up the catalogtracker with our doctored Connection.
       final CatalogTracker ct = constructAndStartCatalogTracker(connection);
       try {
@@ -248,6 +242,37 @@ public class TestCatalogTracker {
   }
 
   /**
+   * Test we survive a connection refused {@link ConnectException}
+   * @throws IOException
+   * @throws InterruptedException
+   * @throws KeeperException
+   */
+  @Test
+  public void testGetMetaServerConnectionFails()
+  throws IOException, InterruptedException, KeeperException {
+    testVerifyMetaRegionLocationWithException(new ConnectException("Connection refused"));
+  }
+
+  /**
+   * Test that verifyMetaRegionLocation properly handles getting a
+   * ServerNotRunningException. See HBASE-4470.
+   * Note this doesn't check the exact exception thrown in the
+   * HBASE-4470 as there it is thrown from getHConnection() and
+   * here it is thrown from get() -- but those are both called
+   * from the same function anyway, and this way is less invasive than
+   * throwing from getHConnection would be.
+   *
+   * @throws IOException
+   * @throws InterruptedException
+   * @throws KeeperException
+   */
+  @Test
+  public void testVerifyMetaRegionServerNotRunning()
+  throws IOException, InterruptedException, KeeperException {
+    testVerifyMetaRegionLocationWithException(new ServerNotRunningYetException("mock"));
+  }
+
+  /**
    * Test get of root region fails properly if nothing to connect to.
    * @throws IOException
    * @throws InterruptedException