HBASE-14552 (addendum) Procedure V2: Reimplement DispatchMergingRegionHandler (add nonce support) (Stephen Yuan Jiang)

This commit is contained in:
Stephen Yuan Jiang 2016-07-19 08:49:23 -07:00
parent 9454daf25b
commit 638ca24f01
3 changed files with 20 additions and 7 deletions

View File

@ -1614,7 +1614,7 @@ public class HBaseAdmin implements Admin {
}
DispatchMergingRegionsResponse response =
executeCallable(new MasterCallable<DispatchMergingRegionsResponse>(getConnection()) {
executeCallable(new MasterCallable<DispatchMergingRegionsResponse>(getConnection()) {
@Override
public DispatchMergingRegionsResponse call(int callTimeout) throws ServiceException {
PayloadCarryingRpcController controller = rpcControllerFactory.newController();
@ -1622,8 +1622,12 @@ public class HBaseAdmin implements Admin {
try {
DispatchMergingRegionsRequest request = RequestConverter
.buildDispatchMergingRegionsRequest(encodedNameOfRegionA,
encodedNameOfRegionB, forcible);
.buildDispatchMergingRegionsRequest(
encodedNameOfRegionA,
encodedNameOfRegionB,
forcible,
ng.getNonceGroup(),
ng.newNonce());
return master.dispatchMergingRegions(controller, request);
} catch (DeserializationException de) {
LOG.error("Could not parse destination server name: " + de);

View File

@ -1103,14 +1103,19 @@ public final class RequestConverter {
}
public static DispatchMergingRegionsRequest buildDispatchMergingRegionsRequest(
final byte[] encodedNameOfRegionA, final byte[] encodedNameOfRegionB,
final boolean forcible) throws DeserializationException {
final byte[] encodedNameOfRegionA,
final byte[] encodedNameOfRegionB,
final boolean forcible,
final long nonceGroup,
final long nonce) throws DeserializationException {
DispatchMergingRegionsRequest.Builder builder = DispatchMergingRegionsRequest.newBuilder();
builder.setRegionA(buildRegionSpecifier(
RegionSpecifierType.ENCODED_REGION_NAME, encodedNameOfRegionA));
builder.setRegionB(buildRegionSpecifier(
RegionSpecifierType.ENCODED_REGION_NAME, encodedNameOfRegionB));
builder.setForcible(forcible);
builder.setNonceGroup(nonceGroup);
builder.setNonce(nonce);
return builder.build();
}

View File

@ -1189,8 +1189,12 @@ public class TestAdmin1 {
// Try going to the master directly (that will skip the check in admin)
try {
DispatchMergingRegionsRequest request = RequestConverter
.buildDispatchMergingRegionsRequest(regions.get(1).getFirst().getEncodedNameAsBytes(),
regions.get(2).getFirst().getEncodedNameAsBytes(), true);
.buildDispatchMergingRegionsRequest(
regions.get(1).getFirst().getEncodedNameAsBytes(),
regions.get(2).getFirst().getEncodedNameAsBytes(),
true,
HConstants.NO_NONCE,
HConstants.NO_NONCE);
((ClusterConnection) TEST_UTIL.getAdmin().getConnection()).getMaster()
.dispatchMergingRegions(null, request);
} catch (ServiceException m) {