Repository: hbase Updated Branches: refs/heads/0.98 8dfbdc9e1 -> b8cb2e43d
HBASE-15805 Canary test timeout if there is failed or shutdown zookeeper node in a quorum (Vishal Khandelwal) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b8cb2e43 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b8cb2e43 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b8cb2e43 Branch: refs/heads/0.98 Commit: b8cb2e43db10be501cf9a5263b7cb6ab184bc0c2 Parents: 8dfbdc9 Author: Andrew Purtell <[email protected]> Authored: Wed May 18 19:49:15 2016 -0700 Committer: Andrew Purtell <[email protected]> Committed: Wed May 18 19:49:15 2016 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/tool/Canary.java | 23 ++++++++------------ 1 file changed, 9 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b8cb2e43/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index b3a858a..cfb9860 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -885,7 +885,7 @@ public final class Canary implements Tool { } List<Future<Void>> taskFutures = new LinkedList<Future<Void>>(); for (HTableDescriptor table : admin.listTables()) { - if (admin.isTableEnabled(table.getTableName()) + if (connection.isTableEnabled(table.getTableName()) && (!table.getTableName().equals(writeTableName))) { taskFutures.addAll(Canary.sniff(connection, sink, table.getTableName(), executor, taskType)); @@ -895,7 +895,7 @@ public final class Canary implements Tool { } private void checkWriteTableDistribution() throws IOException, ServiceException { - if (!admin.tableExists(writeTableName)) { + if (Arrays.binarySearch(connection.listTableNames(), writeTableName) == -1) { int numberOfServers = admin.getClusterStatus().getServers().size(); if (numberOfServers == 0) { throw new IllegalStateException("No live regionservers"); @@ -903,7 +903,7 @@ public final class Canary implements Tool { createWriteTable(numberOfServers); } - if (!admin.isTableEnabled(writeTableName)) { + if (!connection.isTableEnabled(writeTableName)) { admin.enableTable(writeTableName); } @@ -968,18 +968,13 @@ public final class Canary implements Tool { LOG.debug(String.format("checking table is enabled and getting table descriptor for table %s", tableName)); } - HBaseAdmin admin = new HBaseAdmin(connection); - try { - if (admin.isTableEnabled(TableName.valueOf(tableName))) { - return Canary.sniff(connection, sink, TableName.valueOf(tableName), executor, - taskType); - } else { - LOG.warn(String.format("Table %s is not enabled", tableName)); - } - return new LinkedList<Future<Void>>(); - } finally { - admin.close(); + if (connection.isTableEnabled(TableName.valueOf(tableName))) { + return Canary.sniff(connection, sink, TableName.valueOf(tableName), executor, + taskType); + } else { + LOG.warn(String.format("Table %s is not enabled", tableName)); } + return new LinkedList<Future<Void>>(); } /*
