HBASE-9163 Add timeouts to HBaseAdmin because hanging/zombying

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1512077 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-08-08 22:49:18 +00:00
parent c8530f81d4
commit eb197cbf04
1 changed files with 47 additions and 47 deletions

View File

@ -112,7 +112,7 @@ public class TestAdmin {
public void tearDown() throws Exception { public void tearDown() throws Exception {
} }
@Test @Test (timeout=300000)
public void testSplitFlushCompactUnknownTable() throws InterruptedException { public void testSplitFlushCompactUnknownTable() throws InterruptedException {
final String unknowntable = "fubar"; final String unknowntable = "fubar";
Exception exception = null; Exception exception = null;
@ -140,7 +140,7 @@ public class TestAdmin {
assertTrue(exception instanceof TableNotFoundException); assertTrue(exception instanceof TableNotFoundException);
} }
@Test @Test (timeout=300000)
public void testDeleteEditUnknownColumnFamilyAndOrTable() throws IOException { public void testDeleteEditUnknownColumnFamilyAndOrTable() throws IOException {
// Test we get exception if we try to // Test we get exception if we try to
final String nonexistent = "nonexistent"; final String nonexistent = "nonexistent";
@ -233,7 +233,7 @@ public class TestAdmin {
} }
} }
@Test @Test (timeout=300000)
public void testDisableAndEnableTable() throws IOException { public void testDisableAndEnableTable() throws IOException {
final byte [] row = Bytes.toBytes("row"); final byte [] row = Bytes.toBytes("row");
final byte [] qualifier = Bytes.toBytes("qualifier"); final byte [] qualifier = Bytes.toBytes("qualifier");
@ -277,7 +277,7 @@ public class TestAdmin {
ht.close(); ht.close();
} }
@Test @Test (timeout=300000)
public void testDisableAndEnableTables() throws IOException { public void testDisableAndEnableTables() throws IOException {
final byte [] row = Bytes.toBytes("row"); final byte [] row = Bytes.toBytes("row");
final byte [] qualifier = Bytes.toBytes("qualifier"); final byte [] qualifier = Bytes.toBytes("qualifier");
@ -328,7 +328,7 @@ public class TestAdmin {
ht2.close(); ht2.close();
} }
@Test @Test (timeout=300000)
public void testCreateTable() throws IOException { public void testCreateTable() throws IOException {
HTableDescriptor [] tables = admin.listTables(); HTableDescriptor [] tables = admin.listTables();
int numTables = tables.length; int numTables = tables.length;
@ -341,7 +341,7 @@ public class TestAdmin {
TableName.valueOf("testCreateTable"))); TableName.valueOf("testCreateTable")));
} }
@Test @Test (timeout=300000)
public void testGetTableDescriptor() throws IOException { public void testGetTableDescriptor() throws IOException {
HColumnDescriptor fam1 = new HColumnDescriptor("fam1"); HColumnDescriptor fam1 = new HColumnDescriptor("fam1");
HColumnDescriptor fam2 = new HColumnDescriptor("fam2"); HColumnDescriptor fam2 = new HColumnDescriptor("fam2");
@ -357,7 +357,7 @@ public class TestAdmin {
table.close(); table.close();
} }
@Test @Test (timeout=300000)
public void testHColumnValidName() { public void testHColumnValidName() {
boolean exceptionThrown; boolean exceptionThrown;
try { try {
@ -368,7 +368,7 @@ public class TestAdmin {
} }
} }
@Test @Test (timeout=300000)
public void testIsEnabledOnNonexistentTable() throws IOException { public void testIsEnabledOnNonexistentTable() throws IOException {
try { try {
assertFalse(admin.isTableEnabled(Bytes.toBytes("non-existing"))); assertFalse(admin.isTableEnabled(Bytes.toBytes("non-existing")));
@ -381,7 +381,7 @@ public class TestAdmin {
* @throws IOException * @throws IOException
* @throws InterruptedException * @throws InterruptedException
*/ */
@Test @Test (timeout=300000)
public void testOnlineChangeTableSchema() throws IOException, InterruptedException { public void testOnlineChangeTableSchema() throws IOException, InterruptedException {
final TableName tableName = final TableName tableName =
TableName.valueOf("changeTableSchemaOnline"); TableName.valueOf("changeTableSchemaOnline");
@ -470,7 +470,7 @@ public class TestAdmin {
assertFalse(this.admin.tableExists(tableName)); assertFalse(this.admin.tableExists(tableName));
} }
@Test @Test (timeout=300000)
public void testShouldFailOnlineSchemaUpdateIfOnlineSchemaIsNotEnabled() public void testShouldFailOnlineSchemaUpdateIfOnlineSchemaIsNotEnabled()
throws Exception { throws Exception {
final byte[] tableName = Bytes.toBytes("changeTableSchemaOnlineFailure"); final byte[] tableName = Bytes.toBytes("changeTableSchemaOnlineFailure");
@ -557,7 +557,7 @@ public class TestAdmin {
} }
} }
@Test @Test (timeout=300000)
public void testCreateTableNumberOfRegions() throws IOException, InterruptedException { public void testCreateTableNumberOfRegions() throws IOException, InterruptedException {
byte[] tableName = Bytes.toBytes("testCreateTableNumberOfRegions"); byte[] tableName = Bytes.toBytes("testCreateTableNumberOfRegions");
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
@ -606,7 +606,7 @@ public class TestAdmin {
ht5.close(); ht5.close();
} }
@Test @Test (timeout=300000)
public void testCreateTableWithRegions() throws IOException, InterruptedException { public void testCreateTableWithRegions() throws IOException, InterruptedException {
byte[] tableName = Bytes.toBytes("testCreateTableWithRegions"); byte[] tableName = Bytes.toBytes("testCreateTableWithRegions");
@ -781,7 +781,7 @@ public class TestAdmin {
ladmin.close(); ladmin.close();
} }
@Test @Test (timeout=300000)
public void testTableAvailableWithRandomSplitKeys() throws Exception { public void testTableAvailableWithRandomSplitKeys() throws Exception {
byte[] tableName = Bytes.toBytes("testTableAvailableWithRandomSplitKeys"); byte[] tableName = Bytes.toBytes("testTableAvailableWithRandomSplitKeys");
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName));
@ -795,8 +795,8 @@ public class TestAdmin {
boolean tableAvailable = admin.isTableAvailable(Bytes.toString(tableName), splitKeys); boolean tableAvailable = admin.isTableAvailable(Bytes.toString(tableName), splitKeys);
assertFalse("Table should be created with 1 row in META", tableAvailable); assertFalse("Table should be created with 1 row in META", tableAvailable);
} }
@Test @Test (timeout=300000)
public void testCreateTableWithOnlyEmptyStartRow() throws IOException { public void testCreateTableWithOnlyEmptyStartRow() throws IOException {
byte[] tableName = Bytes.toBytes("testCreateTableWithOnlyEmptyStartRow"); byte[] tableName = Bytes.toBytes("testCreateTableWithOnlyEmptyStartRow");
byte[][] splitKeys = new byte[1][]; byte[][] splitKeys = new byte[1][];
@ -809,8 +809,8 @@ public class TestAdmin {
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
} }
} }
@Test @Test (timeout=300000)
public void testCreateTableWithEmptyRowInTheSplitKeys() throws IOException{ public void testCreateTableWithEmptyRowInTheSplitKeys() throws IOException{
byte[] tableName = Bytes.toBytes("testCreateTableWithEmptyRowInTheSplitKeys"); byte[] tableName = Bytes.toBytes("testCreateTableWithEmptyRowInTheSplitKeys");
byte[][] splitKeys = new byte[3][]; byte[][] splitKeys = new byte[3][];
@ -826,7 +826,7 @@ public class TestAdmin {
} }
} }
@Test @Test (timeout=300000)
public void testTableExist() throws IOException { public void testTableExist() throws IOException {
final byte [] table = Bytes.toBytes("testTableExist"); final byte [] table = Bytes.toBytes("testTableExist");
boolean exist; boolean exist;
@ -842,7 +842,7 @@ public class TestAdmin {
* @throws Exception * @throws Exception
* @throws IOException * @throws IOException
*/ */
@Test @Test (timeout=300000)
public void testForceSplit() throws Exception { public void testForceSplit() throws Exception {
byte[][] familyNames = new byte[][] { Bytes.toBytes("cf") }; byte[][] familyNames = new byte[][] { Bytes.toBytes("cf") };
int[] rowCounts = new int[] { 6000 }; int[] rowCounts = new int[] { 6000 };
@ -859,7 +859,7 @@ public class TestAdmin {
* *
* @throws IOException * @throws IOException
*/ */
@Test @Test (timeout=300000)
public void testEnableTableRoundRobinAssignment() throws IOException { public void testEnableTableRoundRobinAssignment() throws IOException {
byte[] tableName = Bytes.toBytes("testEnableTableAssignment"); byte[] tableName = Bytes.toBytes("testEnableTableAssignment");
byte[][] splitKeys = { new byte[] { 1, 1, 1 }, new byte[] { 2, 2, 2 }, byte[][] splitKeys = { new byte[] { 1, 1, 1 }, new byte[] { 2, 2, 2 },
@ -916,7 +916,7 @@ public class TestAdmin {
* @throws Exception * @throws Exception
* @throws IOException * @throws IOException
*/ */
@Test @Test (timeout=300000)
public void testForceSplitMultiFamily() throws Exception { public void testForceSplitMultiFamily() throws Exception {
int numVersions = HColumnDescriptor.DEFAULT_VERSIONS; int numVersions = HColumnDescriptor.DEFAULT_VERSIONS;
@ -1086,17 +1086,17 @@ public class TestAdmin {
* @throws IOException * @throws IOException
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Test (expected=IllegalArgumentException.class) @Test (expected=IllegalArgumentException.class, timeout=300000)
public void testEmptyHTableDescriptor() throws IOException { public void testEmptyHTableDescriptor() throws IOException {
this.admin.createTable(new HTableDescriptor()); this.admin.createTable(new HTableDescriptor());
} }
@Test (expected=IllegalArgumentException.class) @Test (expected=IllegalArgumentException.class, timeout=300000)
public void testInvalidHColumnDescriptor() throws IOException { public void testInvalidHColumnDescriptor() throws IOException {
new HColumnDescriptor("/cfamily/name"); new HColumnDescriptor("/cfamily/name");
} }
@Test(timeout=300000) @Test (timeout=300000)
public void testEnableDisableAddColumnDeleteColumn() throws Exception { public void testEnableDisableAddColumnDeleteColumn() throws Exception {
ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL); ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);
TableName tableName = TableName.valueOf("testMasterAdmin"); TableName tableName = TableName.valueOf("testMasterAdmin");
@ -1123,7 +1123,7 @@ public class TestAdmin {
this.admin.deleteTable(tableName); this.admin.deleteTable(tableName);
} }
@Test @Test (timeout=300000)
public void testCreateBadTables() throws IOException { public void testCreateBadTables() throws IOException {
String msg = null; String msg = null;
try { try {
@ -1181,7 +1181,7 @@ public class TestAdmin {
* Test for hadoop-1581 'HBASE: Unopenable tablename bug'. * Test for hadoop-1581 'HBASE: Unopenable tablename bug'.
* @throws Exception * @throws Exception
*/ */
@Test @Test (timeout=300000)
public void testTableNameClash() throws Exception { public void testTableNameClash() throws Exception {
String name = "testTableNameClash"; String name = "testTableNameClash";
admin.createTable(new HTableDescriptor(TableName.valueOf(name + "SOMEUPPERCASE"))); admin.createTable(new HTableDescriptor(TableName.valueOf(name + "SOMEUPPERCASE")));
@ -1197,7 +1197,7 @@ public class TestAdmin {
* issue anymore * issue anymore
* @throws Exception * @throws Exception
*/ */
@Test @Test (timeout=300000)
public void testCreateTableRPCTimeOut() throws Exception { public void testCreateTableRPCTimeOut() throws Exception {
String name = "testCreateTableRPCTimeOut"; String name = "testCreateTableRPCTimeOut";
int oldTimeout = TEST_UTIL.getConfiguration(). int oldTimeout = TEST_UTIL.getConfiguration().
@ -1221,7 +1221,7 @@ public class TestAdmin {
* Test read only tables * Test read only tables
* @throws Exception * @throws Exception
*/ */
@Test @Test (timeout=300000)
public void testReadOnlyTable() throws Exception { public void testReadOnlyTable() throws Exception {
byte [] name = Bytes.toBytes("testReadOnlyTable"); byte [] name = Bytes.toBytes("testReadOnlyTable");
HTable table = TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY); HTable table = TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY);
@ -1238,7 +1238,7 @@ public class TestAdmin {
* start with same. HBASE-771 * start with same. HBASE-771
* @throws IOException * @throws IOException
*/ */
@Test @Test (timeout=300000)
public void testTableNames() throws IOException { public void testTableNames() throws IOException {
byte[][] illegalNames = new byte[][] { byte[][] illegalNames = new byte[][] {
Bytes.toBytes("-bad"), Bytes.toBytes("-bad"),
@ -1267,7 +1267,7 @@ public class TestAdmin {
* For HADOOP-2579 * For HADOOP-2579
* @throws IOException * @throws IOException
*/ */
@Test (expected=TableExistsException.class) @Test (expected=TableExistsException.class, timeout=300000)
public void testTableExistsExceptionWithATable() throws IOException { public void testTableExistsExceptionWithATable() throws IOException {
final byte [] name = Bytes.toBytes("testTableExistsExceptionWithATable"); final byte [] name = Bytes.toBytes("testTableExistsExceptionWithATable");
TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY).close(); TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY).close();
@ -1278,7 +1278,7 @@ public class TestAdmin {
* Can't disable a table if the table isn't in enabled state * Can't disable a table if the table isn't in enabled state
* @throws IOException * @throws IOException
*/ */
@Test (expected=TableNotEnabledException.class) @Test (expected=TableNotEnabledException.class, timeout=300000)
public void testTableNotEnabledExceptionWithATable() throws IOException { public void testTableNotEnabledExceptionWithATable() throws IOException {
final byte [] name = Bytes.toBytes( final byte [] name = Bytes.toBytes(
"testTableNotEnabledExceptionWithATable"); "testTableNotEnabledExceptionWithATable");
@ -1291,7 +1291,7 @@ public class TestAdmin {
* Can't enable a table if the table isn't in disabled state * Can't enable a table if the table isn't in disabled state
* @throws IOException * @throws IOException
*/ */
@Test (expected=TableNotDisabledException.class) @Test (expected=TableNotDisabledException.class, timeout=300000)
public void testTableNotDisabledExceptionWithATable() throws IOException { public void testTableNotDisabledExceptionWithATable() throws IOException {
final byte [] name = Bytes.toBytes( final byte [] name = Bytes.toBytes(
"testTableNotDisabledExceptionWithATable"); "testTableNotDisabledExceptionWithATable");
@ -1307,13 +1307,13 @@ public class TestAdmin {
* For HADOOP-2579 * For HADOOP-2579
* @throws IOException * @throws IOException
*/ */
@Test (expected=TableNotFoundException.class) @Test (expected=TableNotFoundException.class, timeout=300000)
public void testTableNotFoundExceptionWithoutAnyTables() throws IOException { public void testTableNotFoundExceptionWithoutAnyTables() throws IOException {
new HTable(TEST_UTIL.getConfiguration(),"testTableNotFoundExceptionWithoutAnyTables"); new HTable(TEST_UTIL.getConfiguration(),"testTableNotFoundExceptionWithoutAnyTables");
} }
@Test @Test (timeout=300000)
public void testShouldCloseTheRegionBasedOnTheEncodedRegionName() public void testShouldCloseTheRegionBasedOnTheEncodedRegionName()
throws Exception { throws Exception {
TableName TABLENAME = TableName TABLENAME =
@ -1341,7 +1341,7 @@ public class TestAdmin {
isInList); isInList);
} }
@Test @Test (timeout=300000)
public void testCloseRegionIfInvalidRegionNameIsPassed() throws Exception { public void testCloseRegionIfInvalidRegionNameIsPassed() throws Exception {
byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegion1"); byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegion1");
createTableWithDefaultConf(TABLENAME); createTableWithDefaultConf(TABLENAME);
@ -1367,7 +1367,7 @@ public class TestAdmin {
onlineRegions.contains(info)); onlineRegions.contains(info));
} }
@Test @Test (timeout=300000)
public void testCloseRegionThatFetchesTheHRIFromMeta() throws Exception { public void testCloseRegionThatFetchesTheHRIFromMeta() throws Exception {
TableName TABLENAME = TableName TABLENAME =
TableName.valueOf("TestHBACloseRegion2"); TableName.valueOf("TestHBACloseRegion2");
@ -1398,7 +1398,7 @@ public class TestAdmin {
isInList); isInList);
} }
@Test @Test (timeout=300000)
public void testCloseRegionWhenServerNameIsNull() throws Exception { public void testCloseRegionWhenServerNameIsNull() throws Exception {
byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegion3"); byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegion3");
createTableWithDefaultConf(TABLENAME); createTableWithDefaultConf(TABLENAME);
@ -1422,7 +1422,7 @@ public class TestAdmin {
} }
@Test @Test (timeout=300000)
public void testCloseRegionWhenServerNameIsEmpty() throws Exception { public void testCloseRegionWhenServerNameIsEmpty() throws Exception {
byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegionWhenServerNameIsEmpty"); byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegionWhenServerNameIsEmpty");
createTableWithDefaultConf(TABLENAME); createTableWithDefaultConf(TABLENAME);
@ -1445,7 +1445,7 @@ public class TestAdmin {
} }
} }
@Test @Test (timeout=300000)
public void testCloseRegionWhenEncodedRegionNameIsNotGiven() throws Exception { public void testCloseRegionWhenEncodedRegionNameIsNotGiven() throws Exception {
byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegion4"); byte[] TABLENAME = Bytes.toBytes("TestHBACloseRegion4");
createTableWithDefaultConf(TABLENAME); createTableWithDefaultConf(TABLENAME);
@ -1501,7 +1501,7 @@ public class TestAdmin {
* For HBASE-2556 * For HBASE-2556
* @throws IOException * @throws IOException
*/ */
@Test @Test (timeout=300000)
public void testGetTableRegions() throws IOException { public void testGetTableRegions() throws IOException {
byte[] tableName = Bytes.toBytes("testGetTableRegions"); byte[] tableName = Bytes.toBytes("testGetTableRegions");
@ -1525,7 +1525,7 @@ public class TestAdmin {
} }
@Test @Test (timeout=300000)
public void testHLogRollWriting() throws Exception { public void testHLogRollWriting() throws Exception {
setUpforLogRolling(); setUpforLogRolling();
String className = this.getClass().getName(); String className = this.getClass().getName();
@ -1552,7 +1552,7 @@ public class TestAdmin {
assertTrue(("actual count: " + count), count <= 2); assertTrue(("actual count: " + count), count <= 2);
} }
@Test @Test (timeout=300000)
public void testMoveToPreviouslyAssignedRS() throws IOException, InterruptedException { public void testMoveToPreviouslyAssignedRS() throws IOException, InterruptedException {
byte[] tableName = Bytes.toBytes("testMoveToPreviouslyAssignedRS"); byte[] tableName = Bytes.toBytes("testMoveToPreviouslyAssignedRS");
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
@ -1650,7 +1650,7 @@ public class TestAdmin {
/** /**
* HBASE-4417 checkHBaseAvailable() doesn't close zk connections * HBASE-4417 checkHBaseAvailable() doesn't close zk connections
*/ */
@Test @Test (timeout=300000)
public void testCheckHBaseAvailableClosesConnection() throws Exception { public void testCheckHBaseAvailableClosesConnection() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration(); Configuration conf = TEST_UTIL.getConfiguration();
@ -1664,7 +1664,7 @@ public class TestAdmin {
/** /**
* Check that we have an exception if the cluster is not there. * Check that we have an exception if the cluster is not there.
*/ */
@Test @Test (timeout=300000)
public void testCheckHBaseAvailableWithoutCluster() { public void testCheckHBaseAvailableWithoutCluster() {
Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
@ -1693,7 +1693,7 @@ public class TestAdmin {
" HBase was not available"); " HBase was not available");
} }
@Test @Test (timeout=300000)
public void testDisableCatalogTable() throws Exception { public void testDisableCatalogTable() throws Exception {
try { try {
this.admin.disableTable(TableName.META_TABLE_NAME); this.admin.disableTable(TableName.META_TABLE_NAME);
@ -1708,7 +1708,7 @@ public class TestAdmin {
TEST_UTIL.getHBaseAdmin().createTable(htd); TEST_UTIL.getHBaseAdmin().createTable(htd);
} }
@Test @Test (timeout=300000)
public void testGetRegion() throws Exception { public void testGetRegion() throws Exception {
final String name = "testGetRegion"; final String name = "testGetRegion";
LOG.info("Started " + name); LOG.info("Started " + name);
@ -1729,4 +1729,4 @@ public class TestAdmin {
ct.stop(); ct.stop();
} }
} }
} }