hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject svn commit: r1553308 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/master/ main/java/org/apache/hadoop/hbase/master/handler/ test/java/org/apache/hadoop/hbase/master/
Date Tue, 24 Dec 2013 18:03:19 GMT
Author: rajeshbabu
Date: Tue Dec 24 18:03:19 2013
New Revision: 1553308

URL: http://svn.apache.org/r1553308
Log:
HBASE-10215 TableNotFoundException should be thrown after removing stale znode in ETH

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1553308&r1=1553307&r2=1553308&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Tue Dec 24 18:03:19 2013
@@ -2714,8 +2714,15 @@ public class AssignmentManager extends Z
             + " to ENABLED state.");
         // enableTable in sync way during master startup,
         // no need to invoke coprocessor
-        new EnableTableHandler(this.server, tableName,
-            catalogTracker, this, tableLockManager, true).prepare().process();
+        EnableTableHandler eth = new EnableTableHandler(this.server, tableName,
+          catalogTracker, this, tableLockManager, true);
+        try {
+          eth.prepare();
+        } catch (TableNotFoundException e) {
+          LOG.warn("Table " + tableName + " not found in hbase:meta to recover.");
+          continue;
+        }
+        eth.process();
       }
     }
   }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java?rev=1553308&r1=1553307&r2=1553308&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
Tue Dec 24 18:03:19 2013
@@ -91,6 +91,7 @@ public class EnableTableHandler extends 
         } 
         try {
           this.assignmentManager.getZKTable().removeEnablingTable(tableName, true);
+          throw new TableNotFoundException(tableName);
         } catch (KeeperException e) {
           // TODO : Use HBCK to clear such nodes
           LOG.warn("Failed to delete the ENABLING node for the table " + tableName

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java?rev=1553308&r1=1553307&r2=1553308&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java
Tue Dec 24 18:03:19 2013
@@ -948,6 +948,35 @@ public class TestAssignmentManager {
   }
 
   /**
+   * Test verifies whether stale znodes of unknown tables as for the hbase:meta will be removed
or
+   * not.
+   * @throws KeeperException
+   * @throws IOException
+   * @throws Exception
+   */
+  @Test
+  public void testMasterRestartShouldRemoveStaleZnodesOfUnknownTableAsForMeta()
+      throws KeeperException, IOException, Exception {
+    List<ServerName> destServers = new ArrayList<ServerName>(1);
+    destServers.add(SERVERNAME_A);
+    Mockito.when(this.serverManager.createDestinationServersList()).thenReturn(destServers);
+    Mockito.when(this.serverManager.isServerOnline(SERVERNAME_A)).thenReturn(true);
+    HTU.getConfiguration().setInt(HConstants.MASTER_PORT, 0);
+    Server server = new HMaster(HTU.getConfiguration());
+    Whitebox.setInternalState(server, "serverManager", this.serverManager);
+    AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(server,
+        this.serverManager);
+    try {
+      TableName tableName = TableName.valueOf("dummyTable");
+      // set table in enabling state.
+      am.getZKTable().setEnablingTable(tableName);
+      am.joinCluster();
+      assertFalse("Table should not be present in zookeeper.",
+        am.getZKTable().isTablePresent(tableName));
+    } finally {
+    }
+  }
+  /**
    * When a region is in transition, if the region server opening the region goes down,
    * the region assignment takes a long time normally (waiting for timeout monitor to trigger
assign).
    * This test is to make sure SSH reassigns it right away.



Mime
View raw message