Skip to content

KAFKA-20743: Restrict sentinel leader and state epoch in share coord.#22685

Merged
apoorvmittal10 merged 2 commits into
apache:trunkfrom
smjn:KAFKA-20743
Jun 26, 2026
Merged

KAFKA-20743: Restrict sentinel leader and state epoch in share coord.#22685
apoorvmittal10 merged 2 commits into
apache:trunkfrom
smjn:KAFKA-20743

Conversation

@smjn

@smjn smjn commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator
  • currently in ShareCoordinatorShard the writeState RPC allows negative
    leader and state epoch values, readState allows negative
    leaderEpoch and initState allows negative stateEpoch.
  • though these epoch's could never be injected by the client and are
    server controlled, still we need to harden them.
  • the initState call always has the correct stateEpoch (viz groupEpoch)
    by virtue of
    being called from the group coordinator (both in initializing and
    altering offsets).
  • readState is called from
    SharePartition and will always be preceded by initializeState call,
    which sets the stateEpoch (non negative). Furthermore, SharePartition
    also creates new leaderEpoch per leadership change.
  • writeState will always be preceded by readState which will have
    correctly set the leaderEpoch by virtue of SharePartition. And since
    initializeState correctly sets stateEpoch - writes should contain valid
    values for both the epochs.
  • in light of this ShareCoordinatorShard has been tightened.
  • new tests have been added to verify the change.

Reviewers: Andrew Schofield aschofield@confluent.io, Apoorv Mittal
apoorvmittal10@gmail.com

@github-actions github-actions Bot added triage PRs from the community KIP-932 Queues for Kafka labels Jun 26, 2026
@smjn smjn added ci-approved and removed triage PRs from the community labels Jun 26, 2026

@AndrewJSchofield AndrewJSchofield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Looks good to me.

@apoorvmittal10 apoorvmittal10 merged commit cde0d56 into apache:trunk Jun 26, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved KIP-932 Queues for Kafka

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants