Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ protected Message callExecService(RpcController controller,
public CoprocessorServiceResponse call(int callTimeout) throws Exception {
if (rpcController instanceof HBaseRpcController) {
HBaseRpcController hrc = (HBaseRpcController) rpcController;
hrc.reset();
hrc.setPriority(tableName);
hrc.setCallTimeout(callTimeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.CoordinatedStateManager;
import org.apache.hadoop.hbase.Coprocessor;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
Expand Down Expand Up @@ -1482,6 +1483,54 @@ public boolean evaluate() throws Exception {
}
}

@Test(timeout = 60000)
public void testMetaRegionMoveDuringSplit() throws Exception {
final TableName tableName = TableName.valueOf("testMetaRegionMoveDuringSplit");
try {
this.admin.setBalancerRunning(false, true);

ServerName rs1, rs2, rs3;
ClusterStatus status = TESTING_UTIL.getHBaseClusterInterface().getClusterStatus();
ArrayList<ServerName> serverNames = new ArrayList<>(status.getServers());
rs1 = serverNames.get(0);
rs2 = serverNames.get(1);
rs3 = serverNames.get(2);

// Move meta region to rs1
admin.move(Bytes.toBytes("1588230740"), Bytes.toBytes(rs1.getServerName()));
TESTING_UTIL.waitUntilNoRegionsInTransition(60000);

// Create test table
try(Table t = createTableAndWait(tableName, Bytes.toBytes("cf"))) {
insertData(tableName, admin, t);
}

// Move test table to rs2 that is different from the RS of meta region.
// This will cause the problem.
List<HRegion> regions = cluster.getRegions(tableName);
final HRegionInfo hri = getAndCheckSingleTableRegion(regions);
admin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(rs2.getServerName()));
TESTING_UTIL.waitUntilNoRegionsInTransition(60000);

// Find a splittable region
regions = cluster.getRegions(tableName);
final HRegion region = findSplittableRegion(regions);
assertNotNull("not able to find a splittable region", region);

// Split
this.admin.split(region.getRegionInfo().getRegionName(), new byte[] {42});

// Move meta region from rs1 to rs3 during split
this.admin.move(Bytes.toBytes("1588230740"), Bytes.toBytes(rs3.getServerName()));

LOG.info("Waiting for region to come out of RIT");
TESTING_UTIL.waitUntilNoRegionsInTransition(60000);
} finally {
admin.setBalancerRunning(true, false);
TESTING_UTIL.deleteTable(tableName);
}
}

public static class MockedCoordinatedStateManager extends ZkCoordinatedStateManager {

public void initialize(Server server, HRegion region) {
Expand Down