Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-2055

Changed logic of LeaderState.isReady impacts application

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 3.1.0
    • Leader
    • None

    Description

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

      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)); 
      ....

       

      Attachments

        Issue Links

          Activity

            People

              Symious Janus Chow
              duongnguyen Duong
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m