HBASE-21523 Avoid extra logging when the backup system table already exists

Signed-off-by: Peter Somogyi <psomogyi@cloudera.com>
This commit is contained in:
Josh Elser 2018-11-28 21:56:10 -05:00
parent 8a68f0d656
commit fdddc47e77
1 changed files with 7 additions and 1 deletions

View File

@ -229,8 +229,14 @@ public final class BackupSystemTable implements Closeable {
} }
private void waitForSystemTable(Admin admin, TableName tableName) throws IOException { private void waitForSystemTable(Admin admin, TableName tableName) throws IOException {
// Return fast if the table is available and avoid a log message
if (admin.tableExists(tableName) && admin.isTableAvailable(tableName)) {
return;
}
long TIMEOUT = 60000; long TIMEOUT = 60000;
long startTime = EnvironmentEdgeManager.currentTime(); long startTime = EnvironmentEdgeManager.currentTime();
LOG.debug("Backup table {} is not present and available, waiting for it to become so",
tableName);
while (!admin.tableExists(tableName) || !admin.isTableAvailable(tableName)) { while (!admin.tableExists(tableName) || !admin.isTableAvailable(tableName)) {
try { try {
Thread.sleep(100); Thread.sleep(100);
@ -241,7 +247,7 @@ public final class BackupSystemTable implements Closeable {
"Failed to create backup system table " + tableName + " after " + TIMEOUT + "ms"); "Failed to create backup system table " + tableName + " after " + TIMEOUT + "ms");
} }
} }
LOG.debug("Backup table " + tableName + " exists and available"); LOG.debug("Backup table {} exists and available", tableName);
} }
@Override @Override