Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

@startuml
hide empty description

state RECONCILIATION_LOOP {
  state JOINING {
  }
  state STABLE {
  }
  state RECONCILE_ASSIGNMENT {
  }
  state ACK_ASSIGNMENT {
  }
}

JOINING ---> STABLE
JOINING ---> RECONCILE_ASSIGNMENT
STABLE ---> RECONCILE_ASSIGNMENT
RECONCILE_ASSIGNMENT ---> ACK_ASSIGNMENT
ACK_ASSIGNMENT ---> STABLE

[*] ---> UNSUBSCRIBE
UNSUBSCRIBE ---> JOINING
RECONCILIATION_LOOP ---> LEAVING
RECONCILIATION_LOOP ---> FENCED
RECONCILIATION_LOOP ---> FATAL
FENCED ---> JOINING
LEAVING --->  UNSUBSCRIBE
FATAL ---> [*]

@enduml
PlantUML Render Macro
formatPNG

@startuml
hide empty description

[*] --> NOT_IN_GROUP
NOT_IN_GROUP ---> UNJOINED : Consumer.subscribe()

UNJOINED ---> UNJOINED : Heartbeat on retries
UNJOINED ---> STABLE : Heartbeat, epoch = 0
UNJOINED ---> FATAL

STABLE ---> RECONCILING : new assignment received\ntrigger callbacks
STABLE ---> RECONCILING : Consumer.unsubscribe()
STABLE ---> RELEASING_ASSIGNMENT : on HB fencing error, reset epoch,\ntrigger callbacks
STABLE ---> FATAL
STABLE ---> STABLE : Heartbeat

RECONCILING ---> RECONCILING : Heartbeat
RECONCILING ---> RECONCILIATION_COMPLETE : callback completed
RECONCILIATION_COMPLETE ---> STABLE : Send heartbeat w/ full assignment,\nreset interval timer to\nheartbeat.interval.ms
RECONCILIATION_COMPLETE ---> STABLE : Send heartbeat w/ full assignment,\nreset interval timer to\nheartbeat.interval.ms
RECONCILIATION_COMPLETE ---> UNJOINED : unsubscribe()

RELEASING_ASSIGNMENT ---> RELEASING_ASSIGNMENT_COMPLETE : 'onLost' callback completed
RELEASING_ASSIGNMENT_COMPLETE ---> UNJOINED : Send out-of-interval HB
RELEASING_ASSIGNMENT ---> FATAL

FATAL ---> [*]

@enduml

PlantUML Render Macro
formatPNG



David's notes


Gliffy Diagram
macroId7458e62c-1e1e-4d7e-b66f-7c6d61842cd0
displayNameKIP-848 Client State Machine
nameKIP-848 Client State Machine
pagePin4

States:

  • UNSUBSCRIBE: The consumer is not subscribed to any topics nor regex therefore it is not part of a consumer group.
  • JOINING: The consumer has subscribed with topic names or a regex. Consumer send an HB request to join the group with epoch 0 and transitions to Stable.
  • STABLE: While in this state, has nothing to do besides heartbeatting to remain in the group.
  • RECONCILE_ASSIGNMENT: Whenever the consumer received a non-null assignment from the group coordinator, it transitions to this state and reconciles its assignment. It should revoke unnecessary partitions and assign the new ones. This also commits offsets and triggers the rebalance callbacks. When the reconciliation completes, it transitions to ACK_ASSIGNMENT.
  • ACK_ASSIGNMENT: This signals to the HB manager than an HB request must be sent in the next run of the event loop event the HB internal has not expired. It transitions to STABLE when that signal is given.
  • UNSUBSCRIBING: When the consumer calls unsubscribe or close (this can happen anytime), it transitions to this state, cancels any ongoing reconciliation (how to?), revoke partitions/commit offsets. When done, it transitions to UNSUBSCRIBE.
  • FENCED: When the group coordinator fences the member (this can happen anytime), it transition to this state, cancels any ongoing reconciliation (how to?), resets the member epoch and invokes onLost for all partitions. When done, it transitions to JOINING to rejoin the group.
  • FATAL: The consumer enters this state whenever a fatal errors is encountered. This is not recoverable.

Notes

  • When the subscriptions are changed, should we send the next HB immediately?