HBASE-11988 AC/VC system table create on postStartMaster fails too often in test

This commit is contained in:
stack 2014-09-19 20:57:44 -07:00
parent 1c127220f0
commit 22320eeba0
2 changed files with 8 additions and 8 deletions

View File

@ -73,7 +73,7 @@ public class TableNamespaceManager {
private boolean initialized;
static final String NS_INIT_TIMEOUT = "hbase.master.namespace.init.timeout";
static final int DEFAULT_NS_INIT_TIMEOUT = 60000;
static final int DEFAULT_NS_INIT_TIMEOUT = 300000;
public TableNamespaceManager(MasterServices masterServices) {
this.masterServices = masterServices;
@ -82,7 +82,7 @@ public class TableNamespaceManager {
public void start() throws IOException {
if (!MetaTableAccessor.tableExists(masterServices.getShortCircuitConnection(),
TableName.NAMESPACE_TABLE_NAME)) {
TableName.NAMESPACE_TABLE_NAME)) {
LOG.info("Namespace table not found. Creating...");
createNamespaceTable(masterServices);
}
@ -95,8 +95,9 @@ public class TableNamespaceManager {
int timeout = conf.getInt(NS_INIT_TIMEOUT, DEFAULT_NS_INIT_TIMEOUT);
while (!isTableAssigned()) {
if (EnvironmentEdgeManager.currentTime() - startTime + 100 > timeout) {
LOG.warn("Timedout waiting for namespace table to be assigned.");
return;
// We can't do anything if ns is not online.
throw new IOException("Timedout " + timeout + "ms waiting for namespace table to " +
"be assigned");
}
Thread.sleep(100);
}
@ -299,7 +300,7 @@ public class TableNamespaceManager {
}
private boolean isTableAssigned() {
return !masterServices.getAssignmentManager()
.getRegionStates().getRegionsOfTable(TableName.NAMESPACE_TABLE_NAME).isEmpty();
return !masterServices.getAssignmentManager().getRegionStates().
getRegionsOfTable(TableName.NAMESPACE_TABLE_NAME).isEmpty();
}
}

View File

@ -2718,11 +2718,10 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
TableName tableName = TableName.valueOf(table);
long startWait = System.currentTimeMillis();
waitTableAvailable(admin, table, timeoutMillis);
long remainder = System.currentTimeMillis() - startWait;
while (!admin.isTableEnabled(tableName)) {
assertTrue("Timed out waiting for table to become available and enabled " +
Bytes.toStringBinary(table),
System.currentTimeMillis() - remainder < timeoutMillis);
System.currentTimeMillis() - startWait < timeoutMillis);
Thread.sleep(200);
}
// Finally make sure all regions are fully open and online out on the cluster. Regions may be