Revert "HBASE-20194 Remove the explicit timeout config for TestTruncateTableProcedure"
This reverts commit 239d12dae8
.
This commit is contained in:
parent
9f773d36d3
commit
48fcf665d5
|
@ -55,7 +55,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos;
|
||||
|
||||
@Category({ MasterTests.class, MediumTests.class })
|
||||
@Category({MasterTests.class, MediumTests.class})
|
||||
public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
||||
|
||||
@ClassRule
|
||||
|
@ -315,7 +315,7 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
|||
ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout = 60000)
|
||||
public void testTruncateWithPreserveAfterSplit() throws Exception {
|
||||
String[] families = new String[] { "f1", "f2" };
|
||||
byte[][] splitKeys =
|
||||
|
@ -323,10 +323,10 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
|||
TableName tableName = TableName.valueOf(name.getMethodName());
|
||||
RegionInfo[] regions = MasterProcedureTestingUtility.createTable(getMasterProcedureExecutor(),
|
||||
tableName, splitKeys, families);
|
||||
splitAndTruncate(tableName, regions, 1);
|
||||
splitAndTruncate(tableName, regions);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(timeout = 60000)
|
||||
public void testTruncatePreserveWithReplicaRegionAfterSplit() throws Exception {
|
||||
String[] families = new String[] { "f1", "f2" };
|
||||
byte[][] splitKeys =
|
||||
|
@ -334,8 +334,10 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
|||
TableName tableName = TableName.valueOf(name.getMethodName());
|
||||
|
||||
// create a table with region replications
|
||||
TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName).setRegionReplication(3)
|
||||
.setColumnFamilies(Arrays.stream(families)
|
||||
TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName)
|
||||
.setRegionReplication(3)
|
||||
.setColumnFamilies(
|
||||
Arrays.stream(families)
|
||||
.map(fam -> ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(fam)).build())
|
||||
.collect(Collectors.toList()))
|
||||
.build();
|
||||
|
@ -345,17 +347,20 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
|||
new CreateTableProcedure(procExec.getEnvironment(), htd, regions));
|
||||
ProcedureTestingUtility.assertProcNotFailed(procExec.getResult(procId));
|
||||
|
||||
splitAndTruncate(tableName, regions, 3);
|
||||
splitAndTruncate(tableName, regions);
|
||||
}
|
||||
|
||||
private void splitAndTruncate(TableName tableName, RegionInfo[] regions, int regionReplication)
|
||||
throws IOException, InterruptedException {
|
||||
private void splitAndTruncate(TableName tableName, RegionInfo[] regions) throws IOException,
|
||||
InterruptedException {
|
||||
|
||||
// split a region
|
||||
UTIL.getAdmin().split(tableName, new byte[] { '0' });
|
||||
UTIL.getAdmin().split(tableName, new byte[]{'0'});
|
||||
UTIL.waitUntilAllRegionsAssigned(tableName);
|
||||
|
||||
// wait until split really happens
|
||||
UTIL.waitFor(60000,
|
||||
() -> UTIL.getAdmin().getRegions(tableName).size() > regions.length * regionReplication);
|
||||
while (UTIL.getAdmin().getRegions(tableName).size() <= regions.length) {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
|
||||
// disable the table
|
||||
UTIL.getAdmin().disableTable(tableName);
|
||||
|
@ -367,8 +372,5 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
|||
ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
|
||||
|
||||
UTIL.waitUntilAllRegionsAssigned(tableName);
|
||||
// confirm that we have the correct number of regions
|
||||
assertEquals((regions.length + 1) * regionReplication,
|
||||
UTIL.getAdmin().getRegions(tableName).size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue