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 {
|
private void start() throws IOException {
|
||||||
long now = 0;
|
long now = 0;
|
||||||
|
|
||||||
container.start();
|
|
||||||
reportManager.init();
|
reportManager.init();
|
||||||
initCommandHandlerThread(conf);
|
initCommandHandlerThread(conf);
|
||||||
|
|
||||||
|
@ -106,7 +106,8 @@ public EndpointStateMachine.EndPointStates call() throws Exception {
|
|||||||
volumeSet.writeUnlock();
|
volumeSet.writeUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
ozoneContainer.getDispatcher().setScmId(scmId);
|
// Start the container services after getting the version information
|
||||||
|
ozoneContainer.start(scmId);
|
||||||
|
|
||||||
EndpointStateMachine.EndPointStates nextState =
|
EndpointStateMachine.EndPointStates nextState =
|
||||||
rpcEndPoint.getState().getNextState();
|
rpcEndPoint.getState().getNextState();
|
||||||
|
@ -180,12 +180,13 @@ private void stopContainerScrub() {
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void start() throws IOException {
|
public void start(String scmId) throws IOException {
|
||||||
LOG.info("Attempting to start container services.");
|
LOG.info("Attempting to start container services.");
|
||||||
startContainerScrub();
|
startContainerScrub();
|
||||||
writeChannel.start();
|
writeChannel.start();
|
||||||
readChannel.start();
|
readChannel.start();
|
||||||
hddsDispatcher.init();
|
hddsDispatcher.init();
|
||||||
|
hddsDispatcher.setScmId(scmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,6 +258,21 @@ public void testDatanodeStateContext() throws IOException,
|
|||||||
|
|
||||||
task.execute(executorService);
|
task.execute(executorService);
|
||||||
newState = task.await(10, TimeUnit.SECONDS);
|
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.
|
// If we are in running state, we should be in running.
|
||||||
Assert.assertEquals(DatanodeStateMachine.DatanodeStates.RUNNING,
|
Assert.assertEquals(DatanodeStateMachine.DatanodeStates.RUNNING,
|
||||||
newState);
|
newState);
|
||||||
|
@ -68,7 +68,7 @@ public void testCloseContainerViaRatis()
|
|||||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||||
final OzoneContainer ozoneContainer =
|
final OzoneContainer ozoneContainer =
|
||||||
getOzoneContainer(conf, datanodeDetails);
|
getOzoneContainer(conf, datanodeDetails);
|
||||||
ozoneContainer.start();
|
ozoneContainer.start(UUID.randomUUID().toString());
|
||||||
try {
|
try {
|
||||||
final Container container =
|
final Container container =
|
||||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||||
@ -105,7 +105,7 @@ public void testCloseContainerViaStandalone()
|
|||||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||||
final OzoneContainer ozoneContainer =
|
final OzoneContainer ozoneContainer =
|
||||||
getOzoneContainer(conf, datanodeDetails);
|
getOzoneContainer(conf, datanodeDetails);
|
||||||
ozoneContainer.start();
|
ozoneContainer.start(UUID.randomUUID().toString());
|
||||||
try {
|
try {
|
||||||
final Container container =
|
final Container container =
|
||||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||||
@ -140,7 +140,7 @@ public void testQuasiCloseToClose() throws Exception {
|
|||||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||||
final OzoneContainer ozoneContainer =
|
final OzoneContainer ozoneContainer =
|
||||||
getOzoneContainer(conf, datanodeDetails);
|
getOzoneContainer(conf, datanodeDetails);
|
||||||
ozoneContainer.start();
|
ozoneContainer.start(UUID.randomUUID().toString());
|
||||||
try {
|
try {
|
||||||
final Container container =
|
final Container container =
|
||||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||||
@ -188,7 +188,7 @@ public void testForceCloseOpenContainer() throws Exception {
|
|||||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||||
final OzoneContainer ozoneContainer =
|
final OzoneContainer ozoneContainer =
|
||||||
getOzoneContainer(conf, datanodeDetails);
|
getOzoneContainer(conf, datanodeDetails);
|
||||||
ozoneContainer.start();
|
ozoneContainer.start(UUID.randomUUID().toString());
|
||||||
try {
|
try {
|
||||||
final Container container =
|
final Container container =
|
||||||
createContainer(conf, datanodeDetails, ozoneContainer);
|
createContainer(conf, datanodeDetails, ozoneContainer);
|
||||||
@ -224,7 +224,7 @@ public void testQuasiCloseClosedContainer()
|
|||||||
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
final DatanodeDetails datanodeDetails = randomDatanodeDetails();
|
||||||
final OzoneContainer ozoneContainer = getOzoneContainer(
|
final OzoneContainer ozoneContainer = getOzoneContainer(
|
||||||
conf, datanodeDetails);
|
conf, datanodeDetails);
|
||||||
ozoneContainer.start();
|
ozoneContainer.start(UUID.randomUUID().toString());
|
||||||
try {
|
try {
|
||||||
final Container container = createContainer(
|
final Container container = createContainer(
|
||||||
conf, datanodeDetails, ozoneContainer);
|
conf, datanodeDetails, ozoneContainer);
|
||||||
@ -277,7 +277,6 @@ private OzoneContainer getOzoneContainer(final OzoneConfiguration conf,
|
|||||||
Mockito.when(context.getParent()).thenReturn(datanodeStateMachine);
|
Mockito.when(context.getParent()).thenReturn(datanodeStateMachine);
|
||||||
final OzoneContainer ozoneContainer = new OzoneContainer(
|
final OzoneContainer ozoneContainer = new OzoneContainer(
|
||||||
datanodeDetails, conf, context, null);
|
datanodeDetails, conf, context, null);
|
||||||
ozoneContainer.getDispatcher().setScmId(UUID.randomUUID().toString());
|
|
||||||
return ozoneContainer;
|
return ozoneContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,9 +82,8 @@ public void testCreateOzoneContainer() throws Exception {
|
|||||||
Mockito.when(dsm.getDatanodeDetails()).thenReturn(datanodeDetails);
|
Mockito.when(dsm.getDatanodeDetails()).thenReturn(datanodeDetails);
|
||||||
Mockito.when(context.getParent()).thenReturn(dsm);
|
Mockito.when(context.getParent()).thenReturn(dsm);
|
||||||
container = new OzoneContainer(datanodeDetails, conf, context, null);
|
container = new OzoneContainer(datanodeDetails, conf, context, null);
|
||||||
//Setting scmId, as we start manually ozone container.
|
//Set scmId and manually start ozone container.
|
||||||
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
container.start(UUID.randomUUID().toString());
|
||||||
container.start();
|
|
||||||
|
|
||||||
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
|
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
|
||||||
client.connect();
|
client.connect();
|
||||||
|
@ -155,9 +155,8 @@ public void testCreateOzoneContainer() throws Exception {
|
|||||||
OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, false);
|
OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, false);
|
||||||
|
|
||||||
container = new OzoneContainer(dn, conf, getContext(dn), null);
|
container = new OzoneContainer(dn, conf, getContext(dn), null);
|
||||||
//Setting scmId, as we start manually ozone container.
|
//Set scmId and manually start ozone container.
|
||||||
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
container.start(UUID.randomUUID().toString());
|
||||||
container.start();
|
|
||||||
|
|
||||||
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
|
XceiverClientGrpc client = new XceiverClientGrpc(pipeline, conf);
|
||||||
client.connect();
|
client.connect();
|
||||||
|
@ -143,9 +143,8 @@ public void testCreateOzoneContainer() throws Exception {
|
|||||||
|
|
||||||
DatanodeDetails dn = TestUtils.randomDatanodeDetails();
|
DatanodeDetails dn = TestUtils.randomDatanodeDetails();
|
||||||
container = new OzoneContainer(dn, conf, getContext(dn), caClient);
|
container = new OzoneContainer(dn, conf, getContext(dn), caClient);
|
||||||
//Setting scmId, as we start manually ozone container.
|
//Set scmId and manually start ozone container.
|
||||||
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
container.start(UUID.randomUUID().toString());
|
||||||
container.start();
|
|
||||||
|
|
||||||
UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
|
UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
|
||||||
"user1", new String[] {"usergroup"});
|
"user1", new String[] {"usergroup"});
|
||||||
|
Loading…
Reference in New Issue
Block a user