HDDS-1376. Datanode exits while executing client command when scmId is null (#724)
This commit is contained in:
parent
3ac3e50b20
commit
e543c3b31a
@ -166,7 +166,6 @@ public OzoneContainer getContainer() {
|
||||
private void start() throws IOException {
|
||||
long now = 0;
|
||||
|
||||
container.start();
|
||||
reportManager.init();
|
||||
initCommandHandlerThread(conf);
|
||||
|
||||
|
@ -106,7 +106,8 @@ public EndpointStateMachine.EndPointStates call() throws Exception {
|
||||
volumeSet.writeUnlock();
|
||||
}
|
||||
|
||||
ozoneContainer.getDispatcher().setScmId(scmId);
|
||||
// Start the container services after getting the version information
|
||||
ozoneContainer.start(scmId);
|
||||
|
||||
EndpointStateMachine.EndPointStates nextState =
|
||||
rpcEndPoint.getState().getNextState();
|
||||
|
@ -180,12 +180,13 @@ private void stopContainerScrub() {
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void start() throws IOException {
|
||||
public void start(String scmId) throws IOException {
|
||||
LOG.info("Attempting to start container services.");
|
||||
startContainerScrub();
|
||||
writeChannel.start();
|
||||
readChannel.start();
|
||||
hddsDispatcher.init();
|
||||
hddsDispatcher.setScmId(scmId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,6 +258,21 @@ public void testDatanodeStateContext() throws IOException,
|
||||
|
||||
task.execute(executorService);
|
||||
newState = task.await(10, TimeUnit.SECONDS);
|
||||
|
||||
// Wait for GetVersion call (called by task.execute) to finish. After
|
||||
// Earlier task.execute called into GetVersion. Wait for the execution
|
||||
// to finish and the endPointState to move to REGISTER state.
|
||||
GenericTestUtils.waitFor(() -> {
|
||||
for (EndpointStateMachine endpoint :
|
||||
stateMachine.getConnectionManager().getValues()) {
|
||||
if (endpoint.getState() !=
|
||||
EndpointStateMachine.EndPointStates.REGISTER) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}, 1000, 50000);
|
||||
|
||||
// If we are in running state, we should be in running.
|
||||
Assert.assertEquals(DatanodeStateMachine.DatanodeStates.RUNNING,
|
||||
newState);
|
||||
|
@ -68,7 +68,7 @@ public void testCloseContainerViaRatis()
|
||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||
final OzoneContainer ozoneContainer =
|
||||
getOzoneContainer(conf, datanodeDetails);
|
||||
ozoneContainer.start();
|
||||
ozoneContainer.start(UUID.randomUUID().toString());
|
||||
try {
|
||||
final Container container =
|
||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||
@ -105,7 +105,7 @@ public void testCloseContainerViaStandalone()
|
||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||
final OzoneContainer ozoneContainer =
|
||||
getOzoneContainer(conf, datanodeDetails);
|
||||
ozoneContainer.start();
|
||||
ozoneContainer.start(UUID.randomUUID().toString());
|
||||
try {
|
||||
final Container container =
|
||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||
@ -140,7 +140,7 @@ public void testQuasiCloseToClose() throws Exception {
|
||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||
final OzoneContainer ozoneContainer =
|
||||
getOzoneContainer(conf, datanodeDetails);
|
||||
ozoneContainer.start();
|
||||
ozoneContainer.start(UUID.randomUUID().toString());
|
||||
try {
|
||||
final Container container =
|
||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||
@ -188,7 +188,7 @@ public void testForceCloseOpenContainer() throws Exception {
|
||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||
final OzoneContainer ozoneContainer =
|
||||
getOzoneContainer(conf, datanodeDetails);
|
||||
ozoneContainer.start();
|
||||
ozoneContainer.start(UUID.randomUUID().toString());
|
||||
try {
|
||||
final Container container =
|
||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||
@ -224,7 +224,7 @@ public void testQuasiCloseClosedContainer()
|
||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||
final OzoneContainer ozoneContainer = getOzoneContainer(
|
||||
conf, datanodeDetails);
|
||||
ozoneContainer.start();
|
||||
ozoneContainer.start(UUID.randomUUID().toString());
|
||||
try {
|
||||
final Container container = createContainer(
|
||||
conf, datanodeDetails, ozoneContainer);
|
||||
@ -277,7 +277,6 @@ private OzoneContainer getOzoneContainer(final OzoneConfiguration conf,
|
||||
Mockito.when(context.getParent()).thenReturn(datanodeStateMachine);
|
||||
final OzoneContainer ozoneContainer = new OzoneContainer(
|
||||
datanodeDetails, conf, context, null);
|
||||
ozoneContainer.getDispatcher().setScmId(UUID.randomUUID().toString());
|
||||
return ozoneContainer;
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,8 @@ public void testCreateOzoneContainer() throws Exception {
|
||||
Mockito.when(dsm.getDatanodeDetails()).thenReturn(datanodeDetails);
|
||||
Mockito.when(context.getParent()).thenReturn(dsm);
|
||||
container = new OzoneContainer(datanodeDetails, conf, context, null);
|
||||
//Setting scmId, as we start manually ozone container.
|
||||
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
||||
container.start();
|
||||
//Set scmId and manually start ozone container.
|
||||
container.start(UUID.randomUUID().toString());
|
||||
|
||||
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
|
||||
client.connect();
|
||||
|
@ -155,9 +155,8 @@ public void testCreateOzoneContainer() throws Exception {
|
||||
OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, false);
|
||||
|
||||
container = new OzoneContainer(dn, conf, getContext(dn), null);
|
||||
//Setting scmId, as we start manually ozone container.
|
||||
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
||||
container.start();
|
||||
//Set scmId and manually start ozone container.
|
||||
container.start(UUID.randomUUID().toString());
|
||||
|
||||
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
|
||||
client.connect();
|
||||
|
@ -143,9 +143,8 @@ public void testCreateOzoneContainer() throws Exception {
|
||||
|
||||
DatanodeDetails dn = TestUtils.randomDatanodeDetails();
|
||||
container = new OzoneContainer(dn, conf, getContext(dn), caClient);
|
||||
//Setting scmId, as we start manually ozone container.
|
||||
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
||||
container.start();
|
||||
//Set scmId and manually start ozone container.
|
||||
container.start(UUID.randomUUID().toString());
|
||||
|
||||
UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
|
||||
"user1", new String[] {"usergroup"});
|
||||
|
Loading…
Reference in New Issue
Block a user