HBASE-12694 testTableExistsIfTheSpecifiedTableRegionIsSplitParent in TestSplitTransactionOnCluster class leaves regions in transition (Vandana Ayyalasomayajula)
This commit is contained in:
parent
7bff9efdd9
commit
7dce0d5c45
|
@ -41,6 +41,7 @@ import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.hbase.Abortable;
|
import org.apache.hadoop.hbase.Abortable;
|
||||||
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
import org.apache.hadoop.hbase.CoordinatedStateManager;
|
||||||
import org.apache.hadoop.hbase.Coprocessor;
|
import org.apache.hadoop.hbase.Coprocessor;
|
||||||
|
import org.apache.hadoop.hbase.CoprocessorEnvironment;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
|
@ -200,7 +201,10 @@ 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.latch.await();
|
FailingSplitRegionObserver observer = (FailingSplitRegionObserver) region
|
||||||
|
.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>() {
|
||||||
|
@ -266,7 +270,11 @@ public class TestSplitTransactionOnCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FailingSplitRegionObserver extends BaseRegionObserver {
|
public static class FailingSplitRegionObserver extends BaseRegionObserver {
|
||||||
static volatile CountDownLatch latch = new CountDownLatch(1);
|
volatile CountDownLatch latch;
|
||||||
|
@Override
|
||||||
|
public void start(CoprocessorEnvironment e) throws IOException {
|
||||||
|
latch = 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 {
|
||||||
|
@ -649,10 +657,19 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue