HBASE-11517 TestReplicaWithCluster turns zombie -- ADDS TIMEOUTS SO CAN DEBUG ZOMBIE

This commit is contained in:
stack 2014-07-15 10:02:51 -07:00
parent 995a5a6c68
commit bb73791dad
1 changed files with 38 additions and 24 deletions

View File

@ -129,7 +129,7 @@ public class TestReplicaWithCluster {
HTU.shutdownMiniCluster();
}
@Test
@Test (timeout=30000)
public void testCreateDeleteTable() throws IOException {
// Create table then get the single region for our new table.
HTableDescriptor hdt = HTU.createTableDescriptor("testCreateDeleteTable");
@ -162,7 +162,7 @@ public class TestReplicaWithCluster {
HTU.deleteTable(hdt.getTableName());
}
@Test
@Test (timeout=30000)
public void testChangeTable() throws Exception {
HTableDescriptor hdt = HTU.createTableDescriptor("testChangeTable");
hdt.setRegionReplication(NB_SERVERS);
@ -210,16 +210,20 @@ public class TestReplicaWithCluster {
HTU.getHBaseCluster().stopMaster(0);
HBaseAdmin admin = new HBaseAdmin(HTU.getConfiguration());
nHdt =admin.getTableDescriptor(hdt.getTableName());
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
try {
nHdt = admin.getTableDescriptor(hdt.getTableName());
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
bHdt.getColumnFamilies().length + 1, nHdt.getColumnFamilies().length);
admin.disableTable(hdt.getTableName());
admin.deleteTable(hdt.getTableName());
HTU.getHBaseCluster().startMaster();
admin.disableTable(hdt.getTableName());
admin.deleteTable(hdt.getTableName());
HTU.getHBaseCluster().startMaster();
} finally {
if (admin != null) admin.close();
}
}
@Test
@Test (timeout=30000)
public void testReplicaAndReplication() throws Exception {
HTableDescriptor hdt = HTU.createTableDescriptor("testReplicaAndReplication");
hdt.setRegionReplication(NB_SERVERS);
@ -242,19 +246,23 @@ public class TestReplicaWithCluster {
HTU2.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
ReplicationAdmin admin = new ReplicationAdmin(HTU.getConfiguration());
admin.addPeer("2", HTU2.getClusterKey());
try {
admin.addPeer("2", HTU2.getClusterKey());
} finally {
if (admin != null) admin.close();
}
Put p = new Put(row);
p.add(row, row, row);
final HTable table = new HTable(HTU.getConfiguration(), hdt.getTableName());
table.put(p);
try {
table.put(p);
HTU.getHBaseAdmin().flush(table.getTableName());
LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster.");
HTU.getHBaseAdmin().flush(table.getTableName());
LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster.");
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
try {
SlowMeCopro.cdl.set(new CountDownLatch(1));
Get g = new Get(row);
@ -265,15 +273,18 @@ public class TestReplicaWithCluster {
} finally {
SlowMeCopro.cdl.get().countDown();
SlowMeCopro.sleepTime.set(0);
} }
});
}
}});
} finally {
if (table != null) table.close();
}
LOG.info("stale get on the first cluster done. Now for the second.");
final HTable table2 = new HTable(HTU.getConfiguration(), hdt.getTableName());
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
try {
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
try {
SlowMeCopro.cdl.set(new CountDownLatch(1));
Get g = new Get(row);
@ -284,8 +295,11 @@ public class TestReplicaWithCluster {
} finally {
SlowMeCopro.cdl.get().countDown();
SlowMeCopro.sleepTime.set(0);
} }
});
}
}});
} finally {
if (table2 != null) table2.close();
}
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
HTU.deleteTable(hdt.getTableName());