jolshan commented on code in PR #14673:
URL: https://github.com/apache/kafka/pull/14673#discussion_r1380954345


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/CurrentAssignmentBuilder.java:
##########
@@ -34,48 +33,68 @@
  * consumer group protocol. Given the current state of a member and a desired 
or target
  * assignment state, the state machine takes the necessary steps to converge 
them.
  *
- * The member state has the following properties:
- * - Current Epoch:
- *   The current epoch of the member.
+ * State Machine:
+ * - STABLE:
+ *   The member is fully reconciled to the desired target assignment.
  *
- * - Next Epoch:
- *   The desired epoch of the member. It corresponds to the epoch of the 
target/desired assignment.
- *   The member transitions to this epoch when it has revoked the partitions 
that it does not own
- *   or if it does not have to revoke any.
+ *   Valid Transitions:
+ *   - STABLE -> STABLE
+ *     When a new target assignment is installed but the assignment of the 
member
+ *     has not changed, the member transitions to the next epoch and remains in
+ *     the STABLE state.
  *
- * - Previous Epoch:
- *   The epoch of the member when the state was last updated.
+ *   - STABLE -> UNACKNOWLEDGED_ASSIGNMENT
+ *     When a new target assignment is installed and a new assignment is 
computed
+ *     for the member, he transitions to the UNACKNOWLEDGED_ASSIGNMENT state.
  *
- * - Assigned Partitions:
- *   The set of partitions currently assigned to the member. This represents 
what the member should have.
+ *     If the next assignment contains partitions to be revoked, the member 
stays
+ *     in his current epoch. Otherwise, he transitions to the target epoch.
  *
- * - Partitions Pending Revocation:
- *   The set of partitions that the member should revoke before it can 
transition to the next state.
+ *   - STABLE -> UNRELEASED_PARTITIONS
+ *     When a new target assignment is installed and all the newly assigned 
partitions
+ *     are not available yet, he transitions to the UNRELEASED_PARTITIONS state
+ *     and waits until at least one of them is available.
  *
- * - Partitions Pending Assignment:
- *   The set of partitions that the member will eventually receive. The 
partitions in this set are
- *   still owned by other members in the group.
+ * - UNACKNOWLEDGED_ASSIGNMENT:
+ *   The member has received a new assignment from the group coordinator but
+ *   he has not acknowledged it yet. The member is removed from the group if
+ *   he does not acknowledge it within the rebalance timeout.
  *
- * The state machine has three states:
- * - REVOKING:
- *   This state means that the member must revoke partitions before it can 
transition to the next epoch
- *   and thus start receiving new partitions. This is to guarantee that 
offsets of revoked partitions
- *   are committed with the current epoch. The member transitions to the next 
state only when it has
- *   acknowledged the revocation.
+ *   Valid Transitions:
+ *   - UNACKNOWLEDGED_ASSIGNMENT -> STABLE
+ *     When the assignment is acknowledged, the member transitions to the 
STABLE
+ *     state if it is fully reconciled.
  *
- * - ASSIGNING:
- *   This state means that the member waits on partitions which are still 
owned by other members in the
- *   group. It remains in this state until they are all freed up.
+ *   - UNACKNOWLEDGED_ASSIGNMENT -> UNACKNOWLEDGED_ASSIGNMENT
+ *     When the assignment is acknowledged, the member remains in the
+ *     UNACKNOWLEDGED_ASSIGNMENT state if a new assignment is computed.
  *
- * - STABLE:
- *   This state means that the member has received all its assigned partitions.
+ *     If the next assignment contains partitions to be revoked, the member 
stays
+ *     in his current epoch. Otherwise, he transitions to the target epoch.
+ *
+ *   - UNACKNOWLEDGED_ASSIGNMENT -> UNRELEASED_PARTITIONS
+ *     When the assignment is acknowledged, the member transitions to the
+ *     UNRELEASED_PARTITIONS if newly assigned partitions are not available 
yet.
+ *
+ * - UNRELEASED_PARTITIONS:
+ *   The member's reconciliation cannot progress because newly assigned 
partitions
+ *   are still owned by other members in the group. They are not released yet.
  *
- * The reconciliation process is started or re-started whenever a new target 
assignment is installed;
- * the epoch of the new target assignment is different from the next epoch of 
the member. In this transient
- * state, the assigned partitions, the partitions pending revocation and the 
partitions pending assignment
- * are updated. If the partitions pending revocation is not empty, the state 
machine transitions to
- * REVOKING; if partitions pending assignment is not empty, it transitions to 
ASSIGNING; otherwise it
- * transitions to STABLE.
+ *   Valid Transitions:
+ *   - UNRELEASED_PARTITIONS -> STABLE
+ *     The member may transition to the STABLE state if the partitions that he
+ *     was awaiting on are no longer in the desired target assignment.

Review Comment:
   +1 I'm also confused



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to