HBASE-21523 Avoid extra logging when the backup system table already exists
Signed-off-by: Peter Somogyi <psomo...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fdddc47e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fdddc47e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fdddc47e Branch: refs/heads/master Commit: fdddc47e77d57ce1a95d9c194655f0a86d589124 Parents: 8a68f0d Author: Josh Elser <els...@apache.org> Authored: Wed Nov 28 21:56:10 2018 -0500 Committer: Josh Elser <els...@apache.org> Committed: Thu Nov 29 11:40:28 2018 -0500 ---------------------------------------------------------------------- .../apache/hadoop/hbase/backup/impl/BackupSystemTable.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/fdddc47e/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java index d177384..94ccfe5 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java @@ -229,8 +229,14 @@ public final class BackupSystemTable implements Closeable { } 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 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)) { try { Thread.sleep(100); @@ -241,7 +247,7 @@ public final class BackupSystemTable implements Closeable { "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