Revert "HBASE-12694 testTableExistsIfTheSpecifiedTableRegionIsSplitParent in TestSplitTransactionOnCluster class leaves regions in transition (Vandana Ayyalasomayajula)"

This reverts commit f0e27b2f78.
This commit is contained in:
Virag Kothari 2014-12-19 08:38:15 -08:00
parent 2b94aa8c85
commit 29940c286e
2 changed files with 6 additions and 38 deletions

View File

@ -94,7 +94,7 @@ public class SplitTransaction {
private HRegionInfo hri_b; private HRegionInfo hri_b;
private long fileSplitTimeout = 30000; private long fileSplitTimeout = 30000;
public SplitTransactionCoordination.SplitTransactionDetails std; public SplitTransactionCoordination.SplitTransactionDetails std;
boolean useZKForAssignment = true; boolean useZKForAssignment;
/* /*
* Row to split around * Row to split around

View File

@ -47,7 +47,6 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.RegionTransition; import org.apache.hadoop.hbase.RegionTransition;
@ -307,10 +306,7 @@ public class TestSplitTransactionOnCluster {
this.admin.split(region.getRegionName(), new byte[] {42}); this.admin.split(region.getRegionName(), new byte[] {42});
// we have to wait until the SPLITTING state is seen by the master // we have to wait until the SPLITTING state is seen by the master
FailingSplitRegionObserver observer = (FailingSplitRegionObserver) region FailingSplitRegionObserver.latch.await();
.getCoprocessorHost().findCoprocessor(FailingSplitRegionObserver.class.getName());
assertNotNull(observer);
observer.latch.await();
LOG.info("Waiting for region to come out of RIT"); LOG.info("Waiting for region to come out of RIT");
TESTING_UTIL.waitFor(60000, 1000, new Waiter.Predicate<Exception>() { TESTING_UTIL.waitFor(60000, 1000, new Waiter.Predicate<Exception>() {
@ -376,26 +372,13 @@ public class TestSplitTransactionOnCluster {
} }
public static class FailingSplitRegionObserver extends BaseRegionObserver { public static class FailingSplitRegionObserver extends BaseRegionObserver {
volatile CountDownLatch latch; static volatile CountDownLatch latch = new CountDownLatch(1);
volatile CountDownLatch postSplit;
@Override
public void start(CoprocessorEnvironment e) throws IOException {
latch = new CountDownLatch(1);
postSplit = new CountDownLatch(1);
}
@Override @Override
public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx, public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx,
byte[] splitKey, List<Mutation> metaEntries) throws IOException { byte[] splitKey, List<Mutation> metaEntries) throws IOException {
latch.countDown(); latch.countDown();
LOG.info("Causing rollback of region split");
throw new IOException("Causing rollback of region split"); throw new IOException("Causing rollback of region split");
} }
@Override
public void postCompleteSplit(ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
postSplit.countDown();
LOG.info("postCompleteSplit called");
}
} }
/** /**
@ -934,20 +917,10 @@ public class TestSplitTransactionOnCluster {
tableExists = MetaTableAccessor.tableExists(regionServer.getConnection(), tableExists = MetaTableAccessor.tableExists(regionServer.getConnection(),
tableName); tableName);
assertEquals("The specified table should present.", true, tableExists); assertEquals("The specified table should present.", true, tableExists);
Map<String, RegionState> rit = cluster.getMaster().getAssignmentManager().getRegionStates()
.getRegionsInTransition();
assertTrue(rit.size() == 3);
cluster.getMaster().getAssignmentManager().regionOffline(st.getFirstDaughter());
cluster.getMaster().getAssignmentManager().regionOffline(st.getSecondDaughter());
cluster.getMaster().getAssignmentManager().regionOffline(region.getRegionInfo());
rit = cluster.getMaster().getAssignmentManager().getRegionStates()
.getRegionsInTransition();
assertTrue(rit.size() == 0);
} finally { } finally {
admin.setBalancerRunning(true, false); admin.setBalancerRunning(true, false);
cluster.getMaster().setCatalogJanitorEnabled(true); cluster.getMaster().setCatalogJanitorEnabled(true);
t.close(); t.close();
TESTING_UTIL.deleteTable(tableName);
} }
} }
@ -1191,7 +1164,7 @@ public class TestSplitTransactionOnCluster {
} }
} }
@Test(timeout = 120000) @Test
public void testFailedSplit() throws Exception { public void testFailedSplit() throws Exception {
TableName tableName = TableName.valueOf("testFailedSplit"); TableName tableName = TableName.valueOf("testFailedSplit");
byte[] colFamily = Bytes.toBytes("info"); byte[] colFamily = Bytes.toBytes("info");
@ -1208,23 +1181,18 @@ public class TestSplitTransactionOnCluster {
// The following split would fail. // The following split would fail.
admin.split(tableName); admin.split(tableName);
FailingSplitRegionObserver observer = (FailingSplitRegionObserver) actualRegion FailingSplitRegionObserver.latch.await();
.getCoprocessorHost().findCoprocessor(FailingSplitRegionObserver.class.getName());
assertNotNull(observer);
observer.latch.await();
observer.postSplit.await();
LOG.info("Waiting for region to come out of RIT"); LOG.info("Waiting for region to come out of RIT");
TESTING_UTIL.waitFor(60000, 1000, new Waiter.Predicate<Exception>() { TESTING_UTIL.waitFor(60000, 1000, new Waiter.Predicate<Exception>() {
@Override @Override
public boolean evaluate() throws Exception { public boolean evaluate() throws Exception {
RegionStates regionStates = cluster.getMaster().getAssignmentManager().getRegionStates(); RegionStates regionStates = cluster.getMaster().getAssignmentManager().getRegionStates();
Map<String, RegionState> rit = regionStates.getRegionsInTransition(); Map<String, RegionState> rit = regionStates.getRegionsInTransition();
return (rit.size() == 0); return !rit.containsKey(actualRegion.getRegionInfo().getEncodedName());
} }
}); });
regions = TESTING_UTIL.getHBaseAdmin().getTableRegions(tableName); regions = TESTING_UTIL.getHBaseAdmin().getTableRegions(tableName);
assertTrue(regions.size() == 1); assertTrue(regions.size() == 1);
assertTrue(admin.balancer());
} finally { } finally {
table.close(); table.close();
connection.close(); connection.close();