kafka.controller

ReplicaStateMachine

class ReplicaStateMachine extends Logging

This class represents the state machine for replicas. It defines the states that a replica can be in, and transitions to move the replica to another legal state. The different states that a replica can be in are - 1. NewReplica : The controller can create new replicas during partition reassignment. In this state, a replica can only get become follower state change request. Valid previous state is NonExistentReplica 2. OnlineReplica : Once a replica is started and part of the assigned replicas for its partition, it is in this state. In this state, it can get either become leader or become follower state change requests. Valid previous state are NewReplica, OnlineReplica or OfflineReplica 3. OfflineReplica : If a replica dies, it moves to this state. This happens when the broker hosting the replica is down. Valid previous state are NewReplica, OnlineReplica 4. ReplicaDeletionStarted: If replica deletion starts, it is moved to this state. Valid previous state is OfflineReplica 5. ReplicaDeletionSuccessful: If replica responds with no error code in response to a delete replica request, it is moved to this state. Valid previous state is ReplicaDeletionStarted 6. ReplicaDeletionIneligible: If replica deletion fails, it is moved to this state. Valid previous state is ReplicaDeletionStarted 7. NonExistentReplica: If a replica is deleted successfully, it is moved to this state. Valid previous state is ReplicaDeletionSuccessful

Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ReplicaStateMachine
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ReplicaStateMachine(controller: KafkaController)

Type Members

  1. class BrokerChangeListener extends IZkChildListener with Logging

    This is the zookeeper listener that triggers all the state transitions for a replica

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def areAllReplicasForTopicDeleted(topic: String): Boolean

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def debug(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  10. def debug(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  11. def debug(msg: ⇒ String): Unit

    Definition Classes
    Logging
  12. def deregisterListeners(): Unit

  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  15. def error(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  16. def error(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  17. def error(msg: ⇒ String): Unit

    Definition Classes
    Logging
  18. def fatal(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  19. def fatal(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  20. def fatal(msg: ⇒ String): Unit

    Definition Classes
    Logging
  21. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def handleStateChange(partitionAndReplica: PartitionAndReplica, targetState: ReplicaState, callbacks: Callbacks): Unit

    This API exercises the replica's state machine.

    This API exercises the replica's state machine. It ensures that every state transition happens from a legal previous state to the target state. Valid state transitions are: NonExistentReplica --> NewReplica --send LeaderAndIsr request with current leader and isr to the new replica and UpdateMetadata request for the partition to every live broker

    NewReplica -> OnlineReplica --add the new replica to the assigned replica list if needed

    OnlineReplica,OfflineReplica -> OnlineReplica --send LeaderAndIsr request with current leader and isr to the new replica and UpdateMetadata request for the partition to every live broker

    NewReplica,OnlineReplica,OfflineReplica,ReplicaDeletionIneligible -> OfflineReplica --send StopReplicaRequest to the replica (w/o deletion) --remove this replica from the isr and send LeaderAndIsr request (with new isr) to the leader replica and UpdateMetadata request for the partition to every live broker.

    OfflineReplica -> ReplicaDeletionStarted --send StopReplicaRequest to the replica (with deletion)

    ReplicaDeletionStarted -> ReplicaDeletionSuccessful -- mark the state of the replica in the state machine

    ReplicaDeletionStarted -> ReplicaDeletionIneligible -- mark the state of the replica in the state machine

    ReplicaDeletionSuccessful -> NonExistentReplica -- remove the replica from the in memory partition replica assignment cache

    partitionAndReplica

    The replica for which the state transition is invoked

    targetState

    The end state that the replica should be moved to

  24. def handleStateChanges(replicas: Set[PartitionAndReplica], targetState: ReplicaState, callbacks: Callbacks = new CallbackBuilder).build): Unit

    This API is invoked by the broker change controller callbacks and the startup API of the state machine

    This API is invoked by the broker change controller callbacks and the startup API of the state machine

    replicas

    The list of replicas (brokers) that need to be transitioned to the target state

    targetState

    The state that the replicas should be moved to The controller's allLeaders cache should have been updated before this

  25. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  26. def info(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  27. def info(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  28. def info(msg: ⇒ String): Unit

    Definition Classes
    Logging
  29. def isAnyReplicaInState(topic: String, state: ReplicaState): Boolean

  30. def isAtLeastOneReplicaInDeletionStartedState(topic: String): Boolean

  31. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  32. var logIdent: String

    Attributes
    protected
    Definition Classes
    Logging
  33. lazy val logger: Logger

    Definition Classes
    Logging
  34. val loggerName: String

    Definition Classes
    Logging
  35. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  38. def partitionsAssignedToBroker(topics: Seq[String], brokerId: Int): Seq[TopicAndPartition]

  39. def registerListeners(): Unit

  40. def replicasInDeletionStates(topic: String): Set[PartitionAndReplica]

  41. def replicasInState(topic: String, state: ReplicaState): Set[PartitionAndReplica]

  42. def shutdown(): Unit

    Invoked on controller shutdown.

  43. def startup(): Unit

    Invoked on successful controller election.

    Invoked on successful controller election. First registers a broker change listener since that triggers all state transitions for replicas. Initializes the state of replicas for all partitions by reading from zookeeper. Then triggers the OnlineReplica state change for all replicas.

  44. def swallow(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  45. def swallowDebug(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  46. def swallowError(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  47. def swallowInfo(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  48. def swallowTrace(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  49. def swallowWarn(action: ⇒ Unit): Unit

    Definition Classes
    Logging
  50. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  51. def toString(): String

    Definition Classes
    AnyRef → Any
  52. def trace(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  53. def trace(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  54. def trace(msg: ⇒ String): Unit

    Definition Classes
    Logging
  55. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. def warn(msg: ⇒ String, e: ⇒ Throwable): Unit

    Definition Classes
    Logging
  59. def warn(e: ⇒ Throwable): Any

    Definition Classes
    Logging
  60. def warn(msg: ⇒ String): Unit

    Definition Classes
    Logging

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped