ivandika3 commented on code in PR #10525:
URL: https://github.com/apache/ozone/pull/10525#discussion_r3451512411


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManagerImpl.java:
##########
@@ -404,23 +404,30 @@ public void updateContainerStateWithSequenceId(final 
HddsProtos.ContainerID cont
           LOG.warn("Container sequenceId is {} greater than the leader 
container sequenceId {}",
               containerInfo.getSequenceId(), sequenceId);
         }
-        
-        final LifeCycleState oldState = containerInfo.getState();
-        final LifeCycleState newState = stateMachine.getNextState(
-            oldState, event);
-        if (newState.getNumber() > oldState.getNumber()) {
-          ExecutionUtil.create(() -> {
-            containers.updateState(id, oldState, newState);
-            transactionBuffer.addToBuffer(containerStore, id,
-                containers.getContainerInfo(id));
-          }).onException(() -> {
-            containers.updateState(id, newState, oldState);
-            ContainerInfo currentInfo = containers.getContainerInfo(id);
-            transactionBuffer.addToBuffer(containerStore, id, currentInfo);
-
-          }).execute();
-          containerStateChangeActions.getOrDefault(event, info -> { })
-              .accept(containerInfo);
+
+        try {
+          final LifeCycleState oldState = containerInfo.getState();
+          final LifeCycleState newState = stateMachine.getNextState(
+              oldState, event);
+
+          if (newState.getNumber() > oldState.getNumber()) {
+            ExecutionUtil.create(() -> {
+              containers.updateState(id, oldState, newState);
+              transactionBuffer.addToBuffer(containerStore, id,

Review Comment:
   I don't think it's needed since we simply want to catch the 
`invalidStateTransitionException`.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManagerImpl.java:
##########
@@ -404,23 +404,30 @@ public void updateContainerStateWithSequenceId(final 
HddsProtos.ContainerID cont
           LOG.warn("Container sequenceId is {} greater than the leader 
container sequenceId {}",
               containerInfo.getSequenceId(), sequenceId);
         }
-        
-        final LifeCycleState oldState = containerInfo.getState();
-        final LifeCycleState newState = stateMachine.getNextState(
-            oldState, event);
-        if (newState.getNumber() > oldState.getNumber()) {
-          ExecutionUtil.create(() -> {
-            containers.updateState(id, oldState, newState);
-            transactionBuffer.addToBuffer(containerStore, id,
-                containers.getContainerInfo(id));
-          }).onException(() -> {
-            containers.updateState(id, newState, oldState);
-            ContainerInfo currentInfo = containers.getContainerInfo(id);
-            transactionBuffer.addToBuffer(containerStore, id, currentInfo);
-
-          }).execute();
-          containerStateChangeActions.getOrDefault(event, info -> { })
-              .accept(containerInfo);
+
+        try {
+          final LifeCycleState oldState = containerInfo.getState();
+          final LifeCycleState newState = stateMachine.getNextState(
+              oldState, event);
+
+          if (newState.getNumber() > oldState.getNumber()) {
+            ExecutionUtil.create(() -> {
+              containers.updateState(id, oldState, newState);
+              transactionBuffer.addToBuffer(containerStore, id,

Review Comment:
   I don't think it's needed since we simply want to catch the 
`InvalidStateTransitionException`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to