HBASE-19726 Failed to start HMaster due to infinite retrying on meta assign


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/41974efa
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/41974efa
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/41974efa

Branch: refs/heads/HBASE-19064
Commit: 41974efa85a73f1967fc57c8e7df7b1344d56714
Parents: 811afad
Author: Michael Stack <st...@apache.org>
Authored: Fri Feb 2 18:29:33 2018 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Fri Feb 2 18:29:33 2018 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/TableStateManager.java     | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/41974efa/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java
index 8f65f05..b82f47c 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java
@@ -25,6 +25,7 @@ import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.exceptions.IllegalArgumentIOException;
 import org.apache.hbase.thirdparty.com.google.common.collect.Sets;
 import edu.umd.cs.findbugs.annotations.NonNull;
 import edu.umd.cs.findbugs.annotations.Nullable;
@@ -66,7 +67,7 @@ public class TableStateManager {
   public void setTableState(TableName tableName, TableState.State newState) 
throws IOException {
     lock.writeLock().lock();
     try {
-      udpateMetaState(tableName, newState);
+      updateMetaState(tableName, newState);
     } finally {
       lock.writeLock().unlock();
     }
@@ -93,7 +94,7 @@ public class TableStateManager {
         throw new TableNotFoundException(tableName);
       }
       if (currentState.inStates(states)) {
-        udpateMetaState(tableName, newState);
+        updateMetaState(tableName, newState);
         return null;
       } else {
         return currentState.getState();
@@ -121,7 +122,7 @@ public class TableStateManager {
       throw new TableNotFoundException(tableName);
     }
     if (!currentState.inStates(states)) {
-      udpateMetaState(tableName, newState);
+      updateMetaState(tableName, newState);
       return true;
     } else {
       return false;
@@ -178,8 +179,16 @@ public class TableStateManager {
     return currentState.getState();
   }
 
-  protected void udpateMetaState(TableName tableName, TableState.State 
newState)
+  protected void updateMetaState(TableName tableName, TableState.State 
newState)
       throws IOException {
+    if (tableName.equals(TableName.META_TABLE_NAME)) {
+      if (TableState.State.DISABLING.equals(newState) ||
+          TableState.State.DISABLED.equals(newState)) {
+        throw new IllegalArgumentIOException("Cannot disable the meta table; " 
+ newState);
+      }
+      // Otherwise, just return; no need to set ENABLED on meta -- it is 
always ENABLED.
+      return;
+    }
     MetaTableAccessor.updateTableState(master.getConnection(), tableName, 
newState);
   }
 

Reply via email to