HBASE-7981 TestSplitTransactionOnCluster.testShutdownFixupWhenDaughterHasSplit failed in 0.95 build #11 -- ADDED LOGGING

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1451945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-03-02 21:28:21 +00:00
parent eb5fa9a755
commit cb62d5025f
1 changed files with 28 additions and 17 deletions

View File

@ -87,7 +87,7 @@ public class TestSplitTransactionOnCluster {
LogFactory.getLog(TestSplitTransactionOnCluster.class); LogFactory.getLog(TestSplitTransactionOnCluster.class);
private HBaseAdmin admin = null; private HBaseAdmin admin = null;
private MiniHBaseCluster cluster = null; private MiniHBaseCluster cluster = null;
private static final int NB_SERVERS = 2; private static final int NB_SERVERS = 3;
private static CountDownLatch latch = new CountDownLatch(1); private static CountDownLatch latch = new CountDownLatch(1);
private static volatile boolean secondSplit = false; private static volatile boolean secondSplit = false;
private static volatile boolean callRollBack = false; private static volatile boolean callRollBack = false;
@ -421,23 +421,32 @@ public class TestSplitTransactionOnCluster {
// Now split one of the daughters. // Now split one of the daughters.
regionCount = ProtobufUtil.getOnlineRegions(server).size(); regionCount = ProtobufUtil.getOnlineRegions(server).size();
HRegionInfo daughter = daughters.get(0).getRegionInfo(); HRegionInfo daughter = daughters.get(0).getRegionInfo();
LOG.info("Daughter we are going to split: " + daughter);
// Compact first to ensure we have cleaned up references -- else the split // Compact first to ensure we have cleaned up references -- else the split
// will fail. // will fail.
this.admin.compact(daughter.getRegionName()); this.admin.compact(daughter.getRegionName());
daughters = cluster.getRegions(tableName); daughters = cluster.getRegions(tableName);
HRegion daughterRegion = null; HRegion daughterRegion = null;
for (HRegion r: daughters) { for (HRegion r: daughters) {
if (r.getRegionInfo().equals(daughter)) daughterRegion = r; if (r.getRegionInfo().equals(daughter)) {
daughterRegion = r;
LOG.info("Found matching HRI: " + daughterRegion);
break;
}
} }
assertTrue(daughterRegion != null); assertTrue(daughterRegion != null);
for (int i=0; i<100; i++) { for (int i=0; i<100; i++) {
if (!daughterRegion.hasReferences()) break; if (!daughterRegion.hasReferences()) break;
Threads.sleep(100); Threads.sleep(100);
} }
assertFalse("Waiting for refereces to be compacted", daughterRegion.hasReferences()); assertFalse("Waiting for reference to be compacted", daughterRegion.hasReferences());
LOG.info("Daughter hri before split (has been compacted): " + daughter);
split(daughter, server, regionCount); split(daughter, server, regionCount);
// Get list of daughters // Get list of daughters
daughters = cluster.getRegions(tableName); daughters = cluster.getRegions(tableName);
for (HRegion d: daughters) {
LOG.info("Regions before crash: " + d);
}
// Now crash the server // Now crash the server
cluster.abortRegionServer(tableRegionIndex); cluster.abortRegionServer(tableRegionIndex);
waitUntilRegionServerDead(); waitUntilRegionServerDead();
@ -447,7 +456,8 @@ public class TestSplitTransactionOnCluster {
regions = cluster.getRegions(tableName); regions = cluster.getRegions(tableName);
assertEquals(daughters.size(), regions.size()); assertEquals(daughters.size(), regions.size());
for (HRegion r: regions) { for (HRegion r: regions) {
assertTrue(daughters.contains(r)); LOG.info("Regions post crash " + r);
assertTrue("Missing region post crash " + r, daughters.contains(r));
} }
} finally { } finally {
admin.setBalancerRunning(true, false); admin.setBalancerRunning(true, false);
@ -675,10 +685,9 @@ public class TestSplitTransactionOnCluster {
t.put(p); t.put(p);
admin.flush(tableName); admin.flush(tableName);
} }
@Test @Test
public void testShouldThrowIOExceptionIfStoreFileSizeIsEmptyAndSHouldSuccessfullyExecuteRollback() public void testShouldThrowIOExceptionIfStoreFileSizeIsEmptyAndShouldSuccessfullyExecuteRollback()
throws Exception { throws Exception {
final byte[] tableName = Bytes.toBytes("testRollBackShudBeSuccessfulIfStoreFileIsEmpty"); final byte[] tableName = Bytes.toBytes("testRollBackShudBeSuccessfulIfStoreFileIsEmpty");
// Create table then get the single region for our new table. // Create table then get the single region for our new table.
@ -864,11 +873,14 @@ public class TestSplitTransactionOnCluster {
} }
private void removeDaughterFromMeta(final byte [] regionName) throws IOException { private void removeDaughterFromMeta(final byte [] regionName) throws IOException {
HTable metaTable = HTable metaTable = new HTable(TESTING_UTIL.getConfiguration(), HConstants.META_TABLE_NAME);
new HTable(TESTING_UTIL.getConfiguration(), HConstants.META_TABLE_NAME); try {
Delete d = new Delete(regionName); Delete d = new Delete(regionName);
LOG.info("Deleted " + Bytes.toString(regionName)); LOG.info("Deleted " + Bytes.toString(regionName));
metaTable.delete(d); metaTable.delete(d);
} finally {
metaTable.close();
}
} }
/** /**
@ -900,14 +912,13 @@ public class TestSplitTransactionOnCluster {
HRegionServer hrs = getOtherRegionServer(cluster, metaRegionServer); HRegionServer hrs = getOtherRegionServer(cluster, metaRegionServer);
assertNotNull(hrs); assertNotNull(hrs);
assertNotNull(hri); assertNotNull(hri);
LOG. LOG.info("Moving " + hri.getRegionNameAsString() + " from " +
info("Moving " + hri.getRegionNameAsString() + " to " + metaRegionServer.getServerName() + " to " +
hrs.getServerName() + "; metaServerIndex=" + metaServerIndex); hrs.getServerName() + "; metaServerIndex=" + metaServerIndex);
admin.move(hri.getEncodedNameAsBytes(), admin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(hrs.getServerName().toString()));
Bytes.toBytes(hrs.getServerName().toString()));
} }
// Wait till table region is up on the server that is NOT carrying .META.. // Wait till table region is up on the server that is NOT carrying .META..
for (int i=0; i<100; i++) { for (int i = 0; i < 100; i++) {
tableRegionIndex = cluster.getServerWith(hri.getRegionName()); tableRegionIndex = cluster.getServerWith(hri.getRegionName());
if (tableRegionIndex != -1 && tableRegionIndex != metaServerIndex) break; if (tableRegionIndex != -1 && tableRegionIndex != metaServerIndex) break;
LOG.debug("Waiting on region move off the .META. server; current index " + LOG.debug("Waiting on region move off the .META. server; current index " +