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:
parent
8d3133aa0f
commit
940f4a43c0
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue