HBASE-9863 Intermittently TestZooKeeper#testRegionAssignmentAfterMasterRecoveryDueToZKExpiry hangs

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1539129 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-11-05 20:56:10 +00:00
parent 8d3133aa0f
commit 940f4a43c0
2 changed files with 5 additions and 20 deletions

View File

@ -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;
}
}

View File

@ -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 {