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

View File

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