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

State machine preAppend callback can throw exception without having leader to step down.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: StateMachine
    • Labels:
      None

      Description

            try {
              state.appendLog(context);
            } catch (StateMachineException e) {
              // the StateMachineException is thrown by the SM in the preAppend stage.
              // Return the exception in a RaftClientReply.
              RaftClientReply exceptionReply = newExceptionReply(request, e);
              cacheEntry.failWithReply(exceptionReply);
              // leader will step down here
              if (getInfo().isLeader()) {
                leaderState.submitStepDownEvent(LeaderState.StepDownReason.STATE_MACHINE_EXCEPTION);
              }
              return CompletableFuture.completedFuture(exceptionReply);
            }
      

      The state machine can throw a StateMachine exception, which has a flag to disable leader step down action. The default for this flag would be true.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                erose Ethan Rose
                Reporter:
                avijayan Aravindan Vijayan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 1h 10m
                  1h 10m