HDDS-23. Remove SCMNodeAddressList from SCMRegisterRequestProto. Contributed by Nanda Kumar.
This commit is contained in:
parent
7450583721
commit
d72c165161
|
@ -99,8 +99,7 @@ public final class RegisterEndpointTask implements
|
||||||
|
|
||||||
// TODO : Add responses to the command Queue.
|
// TODO : Add responses to the command Queue.
|
||||||
SCMRegisteredCmdResponseProto response = rpcEndPoint.getEndPoint()
|
SCMRegisteredCmdResponseProto response = rpcEndPoint.getEndPoint()
|
||||||
.register(datanodeDetails.getProtoBufMessage(),
|
.register(datanodeDetails.getProtoBufMessage());
|
||||||
conf.getStrings(ScmConfigKeys.OZONE_SCM_NAMES));
|
|
||||||
Preconditions.checkState(UUID.fromString(response.getDatanodeUUID())
|
Preconditions.checkState(UUID.fromString(response.getDatanodeUUID())
|
||||||
.equals(datanodeDetails.getUuid()),
|
.equals(datanodeDetails.getUuid()),
|
||||||
"Unexpected datanode ID in the response.");
|
"Unexpected datanode ID in the response.");
|
||||||
|
|
|
@ -69,12 +69,11 @@ public interface StorageContainerDatanodeProtocol {
|
||||||
/**
|
/**
|
||||||
* Register Datanode.
|
* Register Datanode.
|
||||||
* @param datanodeDetails - Datanode Details.
|
* @param datanodeDetails - Datanode Details.
|
||||||
* @param scmAddresses - List of SCMs this datanode is configured to
|
*
|
||||||
* communicate.
|
|
||||||
* @return SCM Command.
|
* @return SCM Command.
|
||||||
*/
|
*/
|
||||||
SCMRegisteredCmdResponseProto register(DatanodeDetailsProto datanodeDetails,
|
SCMRegisteredCmdResponseProto register(DatanodeDetailsProto datanodeDetails)
|
||||||
String[] scmAddresses) throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a container report.
|
* Send a container report.
|
||||||
|
|
|
@ -156,8 +156,7 @@ public class StorageContainerDatanodeProtocolClientSideTranslatorPB
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SCMRegisteredCmdResponseProto register(
|
public SCMRegisteredCmdResponseProto register(
|
||||||
DatanodeDetailsProto datanodeDetailsProto,
|
DatanodeDetailsProto datanodeDetailsProto) throws IOException {
|
||||||
String[] scmAddresses) throws IOException {
|
|
||||||
SCMRegisterRequestProto.Builder req =
|
SCMRegisterRequestProto.Builder req =
|
||||||
SCMRegisterRequestProto.newBuilder();
|
SCMRegisterRequestProto.newBuilder();
|
||||||
req.setDatanodeDetails(datanodeDetailsProto);
|
req.setDatanodeDetails(datanodeDetailsProto);
|
||||||
|
|
|
@ -68,15 +68,8 @@ public class StorageContainerDatanodeProtocolServerSideTranslatorPB
|
||||||
public StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto
|
public StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto
|
||||||
register(RpcController controller, StorageContainerDatanodeProtocolProtos
|
register(RpcController controller, StorageContainerDatanodeProtocolProtos
|
||||||
.SCMRegisterRequestProto request) throws ServiceException {
|
.SCMRegisterRequestProto request) throws ServiceException {
|
||||||
String[] addressArray = null;
|
|
||||||
|
|
||||||
if (request.hasAddressList()) {
|
|
||||||
addressArray = request.getAddressList().getAddressListList()
|
|
||||||
.toArray(new String[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return impl.register(request.getDatanodeDetails(), addressArray);
|
return impl.register(request.getDatanodeDetails());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,6 @@ message SCMStorageReport {
|
||||||
|
|
||||||
message SCMRegisterRequestProto {
|
message SCMRegisterRequestProto {
|
||||||
required DatanodeDetailsProto datanodeDetails = 1;
|
required DatanodeDetailsProto datanodeDetails = 1;
|
||||||
optional SCMNodeAddressList addressList = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -195,14 +195,12 @@ public class ScmTestMock implements StorageContainerDatanodeProtocol {
|
||||||
* Register Datanode.
|
* Register Datanode.
|
||||||
*
|
*
|
||||||
* @param datanodeDetailsProto DatanodDetailsProto.
|
* @param datanodeDetailsProto DatanodDetailsProto.
|
||||||
* @param scmAddresses - List of SCMs this datanode is configured to
|
|
||||||
* communicate.
|
|
||||||
* @return SCM Command.
|
* @return SCM Command.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public StorageContainerDatanodeProtocolProtos
|
public StorageContainerDatanodeProtocolProtos
|
||||||
.SCMRegisteredCmdResponseProto register(
|
.SCMRegisteredCmdResponseProto register(
|
||||||
DatanodeDetailsProto datanodeDetailsProto, String[] scmAddresses)
|
DatanodeDetailsProto datanodeDetailsProto)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
rpcCount.incrementAndGet();
|
rpcCount.incrementAndGet();
|
||||||
sleepIfNeeded();
|
sleepIfNeeded();
|
||||||
|
|
|
@ -167,17 +167,16 @@ public class SCMDatanodeProtocolServer implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SCMRegisteredCmdResponseProto register(
|
public SCMRegisteredCmdResponseProto register(
|
||||||
HddsProtos.DatanodeDetailsProto datanodeDetails, String[] scmAddresses)
|
HddsProtos.DatanodeDetailsProto datanodeDetails)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// TODO : Return the list of Nodes that forms the SCM HA.
|
// TODO : Return the list of Nodes that forms the SCM HA.
|
||||||
return getRegisteredResponse(scm.getScmNodeManager()
|
return getRegisteredResponse(scm.getScmNodeManager()
|
||||||
.register(datanodeDetails), null);
|
.register(datanodeDetails));
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static SCMRegisteredCmdResponseProto getRegisteredResponse(
|
public static SCMRegisteredCmdResponseProto getRegisteredResponse(
|
||||||
SCMCommand cmd,
|
SCMCommand cmd) {
|
||||||
StorageContainerDatanodeProtocolProtos.SCMNodeAddressList addressList) {
|
|
||||||
Preconditions.checkState(cmd.getClass() == RegisteredCommand.class);
|
Preconditions.checkState(cmd.getClass() == RegisteredCommand.class);
|
||||||
RegisteredCommand rCmd = (RegisteredCommand) cmd;
|
RegisteredCommand rCmd = (RegisteredCommand) cmd;
|
||||||
SCMCmdType type = cmd.getType();
|
SCMCmdType type = cmd.getType();
|
||||||
|
|
|
@ -203,14 +203,12 @@ public class TestEndPoint {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRegister() throws Exception {
|
public void testRegister() throws Exception {
|
||||||
String[] scmAddressArray = new String[1];
|
|
||||||
scmAddressArray[0] = serverAddress.toString();
|
|
||||||
DatanodeDetails nodeToRegister = getDatanodeDetails();
|
DatanodeDetails nodeToRegister = getDatanodeDetails();
|
||||||
try (EndpointStateMachine rpcEndPoint =
|
try (EndpointStateMachine rpcEndPoint =
|
||||||
createEndpoint(
|
createEndpoint(
|
||||||
SCMTestUtils.getConf(), serverAddress, 1000)) {
|
SCMTestUtils.getConf(), serverAddress, 1000)) {
|
||||||
SCMRegisteredCmdResponseProto responseProto = rpcEndPoint.getEndPoint()
|
SCMRegisteredCmdResponseProto responseProto = rpcEndPoint.getEndPoint()
|
||||||
.register(nodeToRegister.getProtoBufMessage(), scmAddressArray);
|
.register(nodeToRegister.getProtoBufMessage());
|
||||||
Assert.assertNotNull(responseProto);
|
Assert.assertNotNull(responseProto);
|
||||||
Assert.assertEquals(nodeToRegister.getUuidString(),
|
Assert.assertEquals(nodeToRegister.getUuidString(),
|
||||||
responseProto.getDatanodeUUID());
|
responseProto.getDatanodeUUID());
|
||||||
|
|
Loading…
Reference in New Issue