ivandika3 opened a new pull request, #10525:
URL: https://github.com/apache/ozone/pull/10525

   ## What changes were proposed in this pull request?
   
   There are methods annotated with @Replicate that can throw 
InvalidStateTransitionException like 
ContainerStateManager#updateContainerStateWithSequenceId.
   
   When the method is applied by SCM Ratis, an exception from the 
StateMachineUpdater path can terminate SCM although it is not really a critical 
error (e.g. if there are duplicate events, we can simply ignore one). The 
interface comment even says replicated methods should be idempotent, but this 
implementation is not fully idempotent for stale/duplicate events.
   
   Example risk:
   
   - Leader submits FINALIZE for OPEN.
   - Before/apply ordering or duplicate report causes the current state to 
already be CLOSING.
   - Applying FINALIZE at CLOSING is invalid.
   - Exception escapes from replicated apply path.
   
   The chance is very low since most of there is a check of the container state 
before in updateContainerStateWithSequenceId the caller will check that the 
current container state is expected, but it's there.
   
   We can try to fix it by
   
   - Inside the replicated implementation, catch 
InvalidStateTransitionException.
   - Log and return without mutation.
   - Treat it as a stale/duplicate lifecycle event, not a fatal 
replicated-state-machine error.
   
   Or we can simply catch InvalidStateTransitionException in 
SCMStateMachine#applyTransaction.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15578
   
   ## How was this patch tested?
   
   CI
   


-- 
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