HBASE-19564 Procedure id is missing in the response of peer related operations

This commit is contained in:
zhangduo 2017-12-20 20:57:37 +08:00
parent 76a044c5d9
commit 62496b5f36
2 changed files with 13 additions and 15 deletions

View File

@ -1886,10 +1886,10 @@ public class MasterRpcServices extends RSRpcServices
public AddReplicationPeerResponse addReplicationPeer(RpcController controller,
AddReplicationPeerRequest request) throws ServiceException {
try {
master.addReplicationPeer(request.getPeerId(),
ReplicationPeerConfigUtil.convert(request.getPeerConfig()), request.getPeerState()
.getState().equals(ReplicationState.State.ENABLED));
return AddReplicationPeerResponse.newBuilder().build();
long procId = master.addReplicationPeer(request.getPeerId(),
ReplicationPeerConfigUtil.convert(request.getPeerConfig()),
request.getPeerState().getState().equals(ReplicationState.State.ENABLED));
return AddReplicationPeerResponse.newBuilder().setProcId(procId).build();
} catch (ReplicationException | IOException e) {
throw new ServiceException(e);
}
@ -1899,8 +1899,8 @@ public class MasterRpcServices extends RSRpcServices
public RemoveReplicationPeerResponse removeReplicationPeer(RpcController controller,
RemoveReplicationPeerRequest request) throws ServiceException {
try {
master.removeReplicationPeer(request.getPeerId());
return RemoveReplicationPeerResponse.newBuilder().build();
long procId = master.removeReplicationPeer(request.getPeerId());
return RemoveReplicationPeerResponse.newBuilder().setProcId(procId).build();
} catch (ReplicationException | IOException e) {
throw new ServiceException(e);
}
@ -1910,8 +1910,8 @@ public class MasterRpcServices extends RSRpcServices
public EnableReplicationPeerResponse enableReplicationPeer(RpcController controller,
EnableReplicationPeerRequest request) throws ServiceException {
try {
master.enableReplicationPeer(request.getPeerId());
return EnableReplicationPeerResponse.newBuilder().build();
long procId = master.enableReplicationPeer(request.getPeerId());
return EnableReplicationPeerResponse.newBuilder().setProcId(procId).build();
} catch (ReplicationException | IOException e) {
throw new ServiceException(e);
}
@ -1921,8 +1921,8 @@ public class MasterRpcServices extends RSRpcServices
public DisableReplicationPeerResponse disableReplicationPeer(RpcController controller,
DisableReplicationPeerRequest request) throws ServiceException {
try {
master.disableReplicationPeer(request.getPeerId());
return DisableReplicationPeerResponse.newBuilder().build();
long procId = master.disableReplicationPeer(request.getPeerId());
return DisableReplicationPeerResponse.newBuilder().setProcId(procId).build();
} catch (ReplicationException | IOException e) {
throw new ServiceException(e);
}
@ -1948,9 +1948,9 @@ public class MasterRpcServices extends RSRpcServices
public UpdateReplicationPeerConfigResponse updateReplicationPeerConfig(RpcController controller,
UpdateReplicationPeerConfigRequest request) throws ServiceException {
try {
master.updateReplicationPeerConfig(request.getPeerId(),
long procId = master.updateReplicationPeerConfig(request.getPeerId(),
ReplicationPeerConfigUtil.convert(request.getPeerConfig()));
return UpdateReplicationPeerConfigResponse.newBuilder().build();
return UpdateReplicationPeerConfigResponse.newBuilder().setProcId(procId).build();
} catch (ReplicationException | IOException e) {
throw new ServiceException(e);
}

View File

@ -54,9 +54,7 @@ public abstract class ModifyPeerProcedure
protected ModifyPeerProcedure(String peerId) {
this.peerId = peerId;
// TODO: temporarily set a 4.0 here to always wait for the procedure exection completed. Change
// to 3.0 or 2.0 after the client modification is done.
this.latch = ProcedurePrepareLatch.createLatch(4, 0);
this.latch = ProcedurePrepareLatch.createLatch(2, 0);
}
public ProcedurePrepareLatch getLatch() {