hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1539129 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master: HMaster.java TableNamespaceManager.java
Date Tue, 05 Nov 2013 20:56:10 GMT
Author: tedyu
Date: Tue Nov  5 20:56:10 2013
New Revision: 1539129

URL: http://svn.apache.org/r1539129
Log:
HBASE-9863 Intermittently TestZooKeeper#testRegionAssignmentAfterMasterRecoveryDueToZKExpiry
hangs


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1539129&r1=1539128&r2=1539129&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Tue
Nov  5 20:56:10 2013
@@ -3102,7 +3102,9 @@ MasterServices, Server {
 
   @Override
   public NamespaceDescriptor getNamespaceDescriptor(String name) throws IOException {
-    if (!isTableNamespaceManagerReady()) {
+    boolean ready = tableNamespaceManager != null &&
+        tableNamespaceManager.isTableAvailableAndInitialized();
+    if (!ready) {
       throw new IOException("Table Namespace Manager not ready yet, try again later");
     }
     NamespaceDescriptor nsd = tableNamespaceManager.get(name);
@@ -3114,17 +3116,11 @@ MasterServices, Server {
 
   @Override
   public List<NamespaceDescriptor> listNamespaceDescriptors() throws IOException {
-    if (!isTableNamespaceManagerReady()) {
-      return Lists.newArrayList();
-    }
     return Lists.newArrayList(tableNamespaceManager.list());
   }
 
   @Override
   public List<HTableDescriptor> listTableDescriptorsByNamespace(String name) throws
IOException {
-    if (!isTableNamespaceManagerReady()) {
-      return Lists.newArrayList();
-    }
     getNamespaceDescriptor(name); // check that namespace exists
     return Lists.newArrayList(tableDescriptors.getByNamespace(name).values());
   }
@@ -3132,9 +3128,6 @@ MasterServices, Server {
   @Override
   public List<TableName> listTableNamesByNamespace(String name) throws IOException
{
     List<TableName> tableNames = Lists.newArrayList();
-    if (!isTableNamespaceManagerReady()) {
-      return tableNames;
-    }
     getNamespaceDescriptor(name); // check that namespace exists
     for (HTableDescriptor descriptor: tableDescriptors.getByNamespace(name).values()) {
       tableNames.add(descriptor.getTableName());
@@ -3142,13 +3135,4 @@ MasterServices, Server {
     return tableNames;
   }
 
-  private boolean isTableNamespaceManagerReady() throws IOException {
-    boolean ready = tableNamespaceManager != null &&
-        tableNamespaceManager.isTableAvailableAndInitialized();
-    if (!ready) {
-      LOG.warn("Table Namespace Manager not ready yet");
-    }
-    return ready;
-  }
-
 }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java?rev=1539129&r1=1539128&r2=1539129&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java
Tue Nov  5 20:56:10 2013
@@ -115,7 +115,8 @@ public class TableNamespaceManager {
 
 
   public synchronized NamespaceDescriptor get(String name) throws IOException {
-    return get(getNamespaceTable(), name);
+    if (!isTableAvailableAndInitialized()) return null;
+    return zkNamespaceManager.get(name);
   }
 
   public synchronized void create(NamespaceDescriptor ns) throws IOException {



Mime
View raw message