hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1364534 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
Date Mon, 23 Jul 2012 07:18:40 GMT
Author: jmhsieh
Date: Mon Jul 23 07:18:40 2012
New Revision: 1364534

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


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

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1364534&r1=1364533&r2=1364534&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Mon Jul 23 07:18:40 2012
@@ -41,7 +41,7 @@ Release 0.90.7 - Unreleased
    HBASE-6385  [0.90 branch] Backport HBASE-4195 to 0.90 (Posible inconsistency in a memstore
read after a reseek, 
                possible performance improvement) (Gregory Chanan)
    HBASE-6392  UnknownRegionException blocks hbck from sideline big overlap regions
-  
+   HBASE-4470  ServerNotRunningException coming out of assignRootAndMeta kills the Master
(Gregory Chanan)  
 
   IMPROVEMENT
    HBASE-5588  Deprecate/remove AssignmentManager#clearRegionFromTransition

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java?rev=1364534&r1=1364533&r2=1364534&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
Mon Jul 23 07:18:40 2012
@@ -25,6 +25,7 @@ import java.net.ConnectException;
 import java.net.NoRouteToHostException;
 import java.net.SocketException;
 import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.logging.Log;
@@ -39,6 +40,7 @@ import org.apache.hadoop.hbase.client.HC
 import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.RetriesExhaustedException;
 import org.apache.hadoop.hbase.ipc.HRegionInterface;
+import org.apache.hadoop.hbase.ipc.ServerNotRunningException;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.zookeeper.MetaNodeTracker;
 import org.apache.hadoop.hbase.zookeeper.RootRegionTracker;
@@ -539,7 +541,17 @@ public class CatalogTracker {
    */
   public boolean verifyMetaRegionLocation(final long timeout)
   throws InterruptedException, IOException {
-    return getMetaServerConnection(true) != null;
+    HRegionInterface connection = null;
+    try {
+      connection = getMetaServerConnection(true);
+    } catch (NotAllMetaRegionsOnlineException e) {
+      // Pass
+    } catch (ServerNotRunningException e) {
+      // Pass -- remote server is not up so can't be carrying .META.
+    } catch (UnknownHostException e) {
+      // Pass -- server name doesn't resolve so it can't be assigned anything.
+    }
+    return connection != null;
   }
 
   MetaNodeTracker getMetaNodeTracker() {

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java?rev=1364534&r1=1364533&r2=1364534&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/catalog/TestCatalogTracker.java
Mon Jul 23 07:18:40 2012
@@ -49,6 +49,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.ServerNotRunningException;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -155,15 +156,13 @@ public class TestCatalogTracker {
     t.join();
   }
 
-  @Test public void testGetMetaServerConnectionFails()
+  private void testVerifyMetaRegionLocationWithException(Exception ex)
   throws IOException, InterruptedException, KeeperException {
     HConnection connection = Mockito.mock(HConnection.class);
-    ConnectException connectException =
-      new ConnectException("Connection refused");
     final HRegionInterface implementation =
       Mockito.mock(HRegionInterface.class);
     Mockito.when(implementation.get((byte [])Mockito.any(), (Get)Mockito.any())).
-      thenThrow(connectException);
+      thenThrow(ex);
     Mockito.when(connection.getHRegionConnection((HServerAddress)Matchers.anyObject(), Matchers.anyBoolean())).
       thenReturn(implementation);
     Assert.assertNotNull(connection.getHRegionConnection(new HServerAddress(), false));
@@ -179,6 +178,31 @@ public class TestCatalogTracker {
     }
   }
 
+  @Test public void testGetMetaServerConnectionFails()
+  throws IOException, InterruptedException, KeeperException {
+    ConnectException connectException =
+      new ConnectException("Connection refused");
+    testVerifyMetaRegionLocationWithException(connectException);
+  }
+
+  /**
+   * 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 ServerNotRunningException("mock"));
+  }
+
   /**
    * Test get of root region fails properly if nothing to connect to.
    * @throws IOException



Mime
View raw message