HBASE-21094 Remove the explicit timeout config for TestTruncateTableProcedure
(cherry picked from commit 74ea011169
)
This commit is contained in:
parent
899982c02d
commit
b0af08bf9b
|
@ -316,7 +316,7 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
||||||
ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
|
ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 60000)
|
@Test
|
||||||
public void testTruncateWithPreserveAfterSplit() throws Exception {
|
public void testTruncateWithPreserveAfterSplit() throws Exception {
|
||||||
String[] families = new String[] { "f1", "f2" };
|
String[] families = new String[] { "f1", "f2" };
|
||||||
byte[][] splitKeys =
|
byte[][] splitKeys =
|
||||||
|
@ -324,10 +324,10 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
||||||
TableName tableName = TableName.valueOf(name.getMethodName());
|
TableName tableName = TableName.valueOf(name.getMethodName());
|
||||||
RegionInfo[] regions = MasterProcedureTestingUtility.createTable(getMasterProcedureExecutor(),
|
RegionInfo[] regions = MasterProcedureTestingUtility.createTable(getMasterProcedureExecutor(),
|
||||||
tableName, splitKeys, families);
|
tableName, splitKeys, families);
|
||||||
splitAndTruncate(tableName, regions);
|
splitAndTruncate(tableName, regions, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 60000)
|
@Test
|
||||||
public void testTruncatePreserveWithReplicaRegionAfterSplit() throws Exception {
|
public void testTruncatePreserveWithReplicaRegionAfterSplit() throws Exception {
|
||||||
String[] families = new String[] { "f1", "f2" };
|
String[] families = new String[] { "f1", "f2" };
|
||||||
byte[][] splitKeys =
|
byte[][] splitKeys =
|
||||||
|
@ -335,10 +335,8 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
||||||
TableName tableName = TableName.valueOf(name.getMethodName());
|
TableName tableName = TableName.valueOf(name.getMethodName());
|
||||||
|
|
||||||
// create a table with region replications
|
// create a table with region replications
|
||||||
TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName)
|
TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName).setRegionReplication(3)
|
||||||
.setRegionReplication(3)
|
.setColumnFamilies(Arrays.stream(families)
|
||||||
.setColumnFamilies(
|
|
||||||
Arrays.stream(families)
|
|
||||||
.map(fam -> ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(fam)).build())
|
.map(fam -> ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(fam)).build())
|
||||||
.collect(Collectors.toList()))
|
.collect(Collectors.toList()))
|
||||||
.build();
|
.build();
|
||||||
|
@ -348,20 +346,18 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
||||||
new CreateTableProcedure(procExec.getEnvironment(), htd, regions));
|
new CreateTableProcedure(procExec.getEnvironment(), htd, regions));
|
||||||
ProcedureTestingUtility.assertProcNotFailed(procExec.getResult(procId));
|
ProcedureTestingUtility.assertProcNotFailed(procExec.getResult(procId));
|
||||||
|
|
||||||
splitAndTruncate(tableName, regions);
|
splitAndTruncate(tableName, regions, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void splitAndTruncate(TableName tableName, RegionInfo[] regions) throws IOException,
|
private void splitAndTruncate(TableName tableName, RegionInfo[] regions, int regionReplication)
|
||||||
InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
|
|
||||||
// split a region
|
// split a region
|
||||||
UTIL.getAdmin().split(tableName, new byte[] { '0' });
|
UTIL.getAdmin().split(tableName, new byte[] { '0' });
|
||||||
UTIL.waitUntilAllRegionsAssigned(tableName);
|
UTIL.waitUntilAllRegionsAssigned(tableName);
|
||||||
|
|
||||||
// wait until split really happens
|
// wait until split really happens
|
||||||
while (UTIL.getAdmin().getRegions(tableName).size() <= regions.length) {
|
UTIL.waitFor(60000,
|
||||||
Thread.sleep(50);
|
() -> UTIL.getAdmin().getRegions(tableName).size() > regions.length * regionReplication);
|
||||||
}
|
|
||||||
|
|
||||||
// disable the table
|
// disable the table
|
||||||
UTIL.getAdmin().disableTable(tableName);
|
UTIL.getAdmin().disableTable(tableName);
|
||||||
|
@ -373,5 +369,8 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase {
|
||||||
ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
|
ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
|
||||||
|
|
||||||
UTIL.waitUntilAllRegionsAssigned(tableName);
|
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