Class

kafka.controller

ReplicaStateMachine

Related Doc: package controller

Permalink

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
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ReplicaStateMachine(controller: KafkaController)

    Permalink

Type Members

  1. class BrokerChangeListener extends IZkChildListener with Logging

    Permalink

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

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def areAllReplicasForTopicDeleted(topic: String): Boolean

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

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

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

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

    Permalink
    Definition Classes
    Logging
  10. def deregisterListeners(): Unit

    Permalink
  11. final def eq(arg0: AnyRef): Boolean

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    Logging
  19. def finalize(): Unit

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

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

    Permalink

    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

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

    Permalink

    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

  23. def hashCode(): Int

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

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

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

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

    Permalink
  28. def isAtLeastOneReplicaInDeletionStartedState(topic: String): Boolean

    Permalink
  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. var logIdent: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  31. lazy val logger: Logger

    Permalink
    Definition Classes
    Logging
  32. val loggerName: String

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

    Permalink
    Definition Classes
    AnyRef
  34. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

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

    Permalink
  37. def registerListeners(): Unit

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

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

    Permalink
  40. def shutdown(): Unit

    Permalink

    Invoked on controller shutdown.

  41. def startup(): Unit

    Permalink

    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.

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  49. def toString(): String

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

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

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

    Permalink
    Definition Classes
    Logging
  53. final def wait(): Unit

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

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

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

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

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

    Permalink
    Definition Classes
    Logging

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped