HDDS-23. Remove SCMNodeAddressList from SCMRegisterRequestProto. Contributed by Nanda Kumar.

This commit is contained in:
Mukul Kumar Singh 2018-05-08 18:11:33 +05:30
parent 7450583721
commit d72c165161
8 changed files with 11 additions and 27 deletions

View File

@ -99,8 +99,7 @@ public EndpointStateMachine.EndPointStates call() throws Exception {
// TODO : Add responses to the command Queue.
SCMRegisteredCmdResponseProto response = rpcEndPoint.getEndPoint()
.register(datanodeDetails.getProtoBufMessage(),
conf.getStrings(ScmConfigKeys.OZONE_SCM_NAMES));
.register(datanodeDetails.getProtoBufMessage());
Preconditions.checkState(UUID.fromString(response.getDatanodeUUID())
.equals(datanodeDetails.getUuid()),
"Unexpected datanode ID in the response.");

View File

@ -69,12 +69,11 @@ SCMHeartbeatResponseProto sendHeartbeat(DatanodeDetailsProto datanodeDetails,
/**
* Register Datanode.
* @param datanodeDetails - Datanode Details.
* @param scmAddresses - List of SCMs this datanode is configured to
* communicate.
*
* @return SCM Command.
*/
SCMRegisteredCmdResponseProto register(DatanodeDetailsProto datanodeDetails,
String[] scmAddresses) throws IOException;
SCMRegisteredCmdResponseProto register(DatanodeDetailsProto datanodeDetails)
throws IOException;
/**
* Send a container report.

View File

@ -156,8 +156,7 @@ public SCMHeartbeatResponseProto sendHeartbeat(
*/
@Override
public SCMRegisteredCmdResponseProto register(
DatanodeDetailsProto datanodeDetailsProto,
String[] scmAddresses) throws IOException {
DatanodeDetailsProto datanodeDetailsProto) throws IOException {
SCMRegisterRequestProto.Builder req =
SCMRegisterRequestProto.newBuilder();
req.setDatanodeDetails(datanodeDetailsProto);

View File

@ -68,15 +68,8 @@ public StorageContainerDatanodeProtocolServerSideTranslatorPB(
public StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto
register(RpcController controller, StorageContainerDatanodeProtocolProtos
.SCMRegisterRequestProto request) throws ServiceException {
String[] addressArray = null;
if (request.hasAddressList()) {
addressArray = request.getAddressList().getAddressListList()
.toArray(new String[0]);
}
try {
return impl.register(request.getDatanodeDetails(), addressArray);
return impl.register(request.getDatanodeDetails());
} catch (IOException e) {
throw new ServiceException(e);
}

View File

@ -146,7 +146,6 @@ message SCMStorageReport {
message SCMRegisterRequestProto {
required DatanodeDetailsProto datanodeDetails = 1;
optional SCMNodeAddressList addressList = 2;
}
/**

View File

@ -195,14 +195,12 @@ private void sleepIfNeeded() {
* Register Datanode.
*
* @param datanodeDetailsProto DatanodDetailsProto.
* @param scmAddresses - List of SCMs this datanode is configured to
* communicate.
* @return SCM Command.
*/
@Override
public StorageContainerDatanodeProtocolProtos
.SCMRegisteredCmdResponseProto register(
DatanodeDetailsProto datanodeDetailsProto, String[] scmAddresses)
DatanodeDetailsProto datanodeDetailsProto)
throws IOException {
rpcCount.incrementAndGet();
sleepIfNeeded();

View File

@ -167,17 +167,16 @@ public SCMHeartbeatResponseProto sendHeartbeat(
@Override
public SCMRegisteredCmdResponseProto register(
HddsProtos.DatanodeDetailsProto datanodeDetails, String[] scmAddresses)
HddsProtos.DatanodeDetailsProto datanodeDetails)
throws IOException {
// TODO : Return the list of Nodes that forms the SCM HA.
return getRegisteredResponse(scm.getScmNodeManager()
.register(datanodeDetails), null);
.register(datanodeDetails));
}
@VisibleForTesting
public static SCMRegisteredCmdResponseProto getRegisteredResponse(
SCMCommand cmd,
StorageContainerDatanodeProtocolProtos.SCMNodeAddressList addressList) {
SCMCommand cmd) {
Preconditions.checkState(cmd.getClass() == RegisteredCommand.class);
RegisteredCommand rCmd = (RegisteredCommand) cmd;
SCMCmdType type = cmd.getType();

View File

@ -203,14 +203,12 @@ public void testGetVersionAssertRpcTimeOut() throws Exception {
@Test
public void testRegister() throws Exception {
String[] scmAddressArray = new String[1];
scmAddressArray[0] = serverAddress.toString();
DatanodeDetails nodeToRegister = getDatanodeDetails();
try (EndpointStateMachine rpcEndPoint =
createEndpoint(
SCMTestUtils.getConf(), serverAddress, 1000)) {
SCMRegisteredCmdResponseProto responseProto = rpcEndPoint.getEndPoint()
.register(nodeToRegister.getProtoBufMessage(), scmAddressArray);
.register(nodeToRegister.getProtoBufMessage());
Assert.assertNotNull(responseProto);
Assert.assertEquals(nodeToRegister.getUuidString(),
responseProto.getDatanodeUUID());