Index: hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 1452151) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -869,18 +869,18 @@ } /* - * @param True if table is online + * @param enabled True if table is enabled */ - private boolean testTableOnlineState(byte [] tableName, boolean online) + private boolean testTableOnlineState(byte [] tableName, boolean enabled) throws IOException { if (Bytes.equals(tableName, HConstants.ROOT_TABLE_NAME)) { // The root region is always enabled - return online; + return enabled; } String tableNameStr = Bytes.toString(tableName); ZooKeeperKeepAliveConnection zkw = getKeepAliveZooKeeperWatcher(); try { - if (online) { + if (enabled) { return ZKTableReadOnly.isEnabledTable(zkw, tableNameStr); } return ZKTableReadOnly.isDisabledTable(zkw, tableNameStr); Index: hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (revision 1452151) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (working copy) @@ -1871,11 +1871,25 @@ return HFileSystem.get(conf); } + /** + * Wait until all regions in a table have been assigned. Waits default timeout before giving up + * (30 seconds). + * @param table Table to wait on. + * @throws InterruptedException + * @throws IOException + */ public void waitTableAvailable(byte[] table) throws InterruptedException, IOException { waitTableAvailable(table, 30000); } + /** + * Wait until all regions in a table have been assigned + * @param table Table to wait on. + * @param timeoutMillis Timeout. + * @throws InterruptedException + * @throws IOException + */ public void waitTableAvailable(byte[] table, long timeoutMillis) throws InterruptedException, IOException { long startWait = System.currentTimeMillis(); @@ -1887,19 +1901,38 @@ } } + /** + * Waits for a table to be 'enabled'. Enabled means that table is set as 'enabled' and the + * regions have been all assigned. Will timeout after default period (30 seconds) + * @see #waitTableAvailable(byte[]) + * @param table Table to wait on. + * @param table + * @throws InterruptedException + * @throws IOException + */ public void waitTableEnabled(byte[] table) throws InterruptedException, IOException { waitTableEnabled(table, 30000); } + /** + * Waits for a table to be 'enabled'. Enabled means that table is set as 'enabled' and the + * regions have been all assigned. + * @see #waitTableAvailable(byte[]) + * @param table Table to wait on. + * @param timeoutMillis Time to wait on it being marked enabled. + * @throws InterruptedException + * @throws IOException + */ public void waitTableEnabled(byte[] table, long timeoutMillis) throws InterruptedException, IOException { long startWait = System.currentTimeMillis(); - while (!getHBaseAdmin().isTableAvailable(table) && - !getHBaseAdmin().isTableEnabled(table)) { + waitTableAvailable(table, timeoutMillis); + long remainder = System.currentTimeMillis() - startWait; + while (!getHBaseAdmin().isTableEnabled(table)) { assertTrue("Timed out waiting for table to become available and enabled " + Bytes.toStringBinary(table), - System.currentTimeMillis() - startWait < timeoutMillis); + System.currentTimeMillis() - remainder < timeoutMillis); Thread.sleep(200); } LOG.debug("REMOVE AFTER table=" + Bytes.toString(table) + ", isTableAvailable=" + Index: hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java (revision 1452151) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java (working copy) @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -90,7 +91,14 @@ @Test public void testQualifierAccess() throws Exception { final HTable table = TEST_UTIL.createTable(TABLE, FAMILY); + try { + doQualifierAccess(table); + } finally { + table.close(); + } + } + private void doQualifierAccess(final HTable table) throws IOException, InterruptedException { // set permissions ADMIN.runAs(new PrivilegedExceptionAction() { @Override