[ 
https://issues.apache.org/jira/browse/RATIS-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17838317#comment-17838317
 ] 

Duong commented on RATIS-2055:
------------------------------

The change impacts Ozone and we know that because we proactively test it with 
Ozone. 

We don't know if it'll impact other ratis applications. And we won't until they 
pick up a release with the change and it could be quite a while.

The only thing we know is the change is not compatible with some corner use 
cases. If we don't fix, have to make sure it's mentioned in the release notes. 
[~Symious] [~szetszwo] 

> Changed logic of LeaderState.isReady impacts application
> --------------------------------------------------------
>
>                 Key: RATIS-2055
>                 URL: https://issues.apache.org/jira/browse/RATIS-2055
>             Project: Ratis
>          Issue Type: Bug
>          Components: Leader
>    Affects Versions: 3.1.0
>            Reporter: Duong
>            Priority: Major
>
> RATIS-2019 changes the logic of `LeaderState.isReady`. Before, isReady itself 
> performs the logic to check if the leader state is ready. After the change, 
> the logic is moved to `LeaderState.checkReady` and `isReady` now only reads 
> the result.
> This change impacts client applications that rely on `isReady` check. For 
> example, Ozone's SCMStateMachine [listens to notifyTermIndexUpdated 
> |https://github.com/apache/ozone/blob/5ff79613e546a09f23b2c3bae61d62fb757eaf70/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java#L359]
>  and checks if the leader state is ready. However, because the 
> `leader.checkReady` is called after the `notifyTermIndexUpdated`, 
> SCMStateMachine never sees leader ready state in the intercepted 
> `notifyTermIndexUpdated` events.
> {code:java|title=RaftServerImpl.applyLogToStateMachine}
> CompletableFuture<Message> 
> applyLogToStateMachine(ReferenceCountedObject<LogEntryProto> nextRef)
>     throws RaftLogIOException {
>   LogEntryProto next = nextRef.get();
>   if (!next.hasStateMachineLogEntry()) {
>     stateMachine.event().notifyTermIndexUpdated(next.getTerm(), 
> next.getIndex());
>   }
>   if (next.hasConfigurationEntry()) {
>     // the reply should have already been set. only need to record
>     // the new conf in the metadata file and notify the StateMachine.
>     state.writeRaftConfiguration(next);
>     stateMachine.event().notifyConfigurationChanged(next.getTerm(), 
> next.getIndex(), next.getConfigurationEntry());
>     role.getLeaderState().ifPresent(leader -> leader.checkReady(next)); 
> ....{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to