Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ public OzoneContainer getContainer() {
private void start() throws IOException {
long now = 0;

container.start();
reportManager.init();
initCommandHandlerThread(conf);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"});
Expand Down