Interface PartitionTransitionStep

All Known Implementing Classes:
AdminApiRequestHandlerStep, BackupApiRequestHandlerStep, BackupServiceTransitionStep, BackupStoreTransitionStep, ExporterDirectorPartitionTransitionStep, InterPartitionCommandServiceStep, LogStoragePartitionTransitionStep, LogStreamPartitionTransitionStep, QueryServicePartitionTransitionStep, SnapshotDirectorPartitionTransitionStep, StreamProcessorTransitionStep, ZeebeDbPartitionTransitionStep

public interface PartitionTransitionStep
A PartitionTransitionStep is an action to be taken while transitioning the partition to a new role

The sequence of method calls is as follows:

  1. onNewRaftRole(..) - called always as soon as a raft role change is announced.
  2. prepareTransition(..) - called on all steps that executed during the last transition; steps will be called in reverse order
  3. transitionTo(...) - called on all steps to perform the actual transition

Note that a transition may be interrupted at any time. To that end, onNewRaftRole(..) can be called at any time and can/should be used as a trigger to cancel the current step. The other methods are called in order. An ongoing transition will only be aborted in between steps, not while a step is running. Also, any subsequent steps will execute only after the currently active step has completed

  • Method Details

    • onNewRaftRole

      default void onNewRaftRole(PartitionTransitionContext context, RaftServer.Role newRole)
      This method is called immediately after the new Raft role is known. It is expected that this method completes instantly. It is called on all steps.

      Steps are expected to pause any active requests and assume a neutral stance after this method is called. After all steps have been notified, the first steps' transitionTo(...) will be called, and then subsequently all other steps. This means that during the time between the call to the method and the call to transitionTo(...) some preceding steps may have already transitioned, but others are still waiting for transition.

      To summarize, after this method is called, the partition is in an undefined state. And as soon as transitionTo(...) is called the partition has completed all transition steps up to this point

      Note, that this may also be called while a transition is currently running, for example if the raft partition transitions faster than the Zeebe partition. In this case steps are encouraged to cancel what they are doing

      Parameters:
      context -
      newRole - target role to transition to
    • prepareTransition

      @Deprecated ActorFuture<Void> prepareTransition(PartitionTransitionContext context, long term, RaftServer.Role targetRole)
      Deprecated.
      This method is a hook to prepare steps for a pending transition. This method is deprecated because eventually we want ro remove it. Once removed, all steps need to take the necessary preparatory steps as part of newRaftRole(...).

      For a time being, however, this method will be supported. Steps will be called in reverse order and are expected to take any steps to assume a neutral stance

    • transitionTo

      ActorFuture<Void> transitionTo(PartitionTransitionContext context, long term, RaftServer.Role targetRole)
      This method is called to start the actual transition
    • getName

      String getName()
      Returns:
      A log-friendly identification of the PartitionTransitionStep.