This is an automated email from the ASF dual-hosted git repository. arp pushed a commit to branch revert-715-HDDS-1370 in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit 5b308cc38cb3167a6899d267efce63c5b1686f29 Author: Arpit Agarwal <a...@users.noreply.github.com> AuthorDate: Wed Apr 10 11:38:08 2019 -0700 Revert "HDDS-1370. Command Execution in Datanode fails because of NPE (#715)" This reverts commit 0e770a65394a2aeaa56154d200c02afbe5bbb5d7. --- .../common/statemachine/StateContext.java | 30 +++++++++------------- .../states/datanode/RunningDatanodeState.java | 11 +------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java index 7e06473..4a979fd 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java @@ -348,26 +348,20 @@ public class StateContext { throws InterruptedException, ExecutionException, TimeoutException { stateExecutionCount.incrementAndGet(); DatanodeState<DatanodeStateMachine.DatanodeStates> task = getTask(); - - // Adding not null check, in a case where datanode is still starting up, but - // we called stop DatanodeStateMachine, this sets state to SHUTDOWN, and - // there is a chance of getting task as null. - if (task != null) { - if (this.isEntering()) { - task.onEnter(); + if (this.isEntering()) { + task.onEnter(); + } + task.execute(service); + DatanodeStateMachine.DatanodeStates newState = task.await(time, unit); + if (this.state != newState) { + if (LOG.isDebugEnabled()) { + LOG.debug("Task {} executed, state transited from {} to {}", + task.getClass().getSimpleName(), this.state, newState); } - task.execute(service); - DatanodeStateMachine.DatanodeStates newState = task.await(time, unit); - if (this.state != newState) { - if (LOG.isDebugEnabled()) { - LOG.debug("Task {} executed, state transited from {} to {}", - task.getClass().getSimpleName(), this.state, newState); - } - if (isExiting(newState)) { - task.onExit(); - } - this.setState(newState); + if (isExiting(newState)) { + task.onExit(); } + this.setState(newState); } } diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java index 6b596fe..ec2358a 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java @@ -86,16 +86,7 @@ public class RunningDatanodeState implements DatanodeState { for (EndpointStateMachine endpoint : connectionManager.getValues()) { Callable<EndpointStateMachine.EndPointStates> endpointTask = getEndPointTask(endpoint); - if (endpointTask != null) { - ecs.submit(endpointTask); - } else { - // This can happen if a task is taking more time than the timeOut - // specified for the task in await, and when it is completed the task - // has set the state to Shutdown, we may see the state as shutdown - // here. So, we need to Shutdown DatanodeStateMachine. - LOG.error("State is Shutdown in RunningDatanodeState"); - context.setState(DatanodeStateMachine.DatanodeStates.SHUTDOWN); - } + ecs.submit(endpointTask); } } //TODO : Cache some of these tasks instead of creating them --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org