Skip to content

refactor(metadata:diskless): preserve leader epoch in metadata#539

Merged
giuseppelillo merged 1 commit intomainfrom
jeqo/pod-2122-preserve-leader-epoch
Mar 16, 2026
Merged

refactor(metadata:diskless): preserve leader epoch in metadata#539
giuseppelillo merged 1 commit intomainfrom
jeqo/pod-2122-preserve-leader-epoch

Conversation

@jeqo
Copy link
Copy Markdown
Contributor

@jeqo jeqo commented Mar 16, 2026

Stop resetting leader epoch to INITIAL_LEADER_EPOCH (0) in InklessTopicMetadataTransformer. Clients depend on epoch monotonicity for fencing (idempotent producers, consumer offset validation), so the original epoch from the controller must be preserved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the diskless-topic metadata transformation logic to stop overwriting the controller-provided leader epoch, preserving epoch monotonicity that clients rely on for fencing and validation.

Changes:

  • Removed logic that reset leaderEpoch to INITIAL_LEADER_EPOCH during metadata/describe transformations.
  • Dropped the now-unused LeaderAndIsr dependency/import.
  • Updated tests to add targeted non-zero leader epoch preservation assertions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
storage/inkless/src/main/java/io/aiven/inkless/metadata/InklessTopicMetadataTransformer.java Stops resetting leaderEpoch, leaving the controller-provided value intact during transformations.
storage/inkless/src/test/java/io/aiven/inkless/metadata/InklessTopicMetadataTransformerTest.java Removes hardcoded leaderEpoch == 0 assertions and adds explicit preservation tests with non-zero epochs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ormer

Stop resetting leader epoch to INITIAL_LEADER_EPOCH (0) in
InklessTopicMetadataTransformer. Clients depend on epoch monotonicity
for fencing (idempotent producers, consumer offset validation), so
the original epoch from the controller must be preserved.
@jeqo jeqo force-pushed the jeqo/pod-2122-preserve-leader-epoch branch from 9f8bcfa to 29a7884 Compare March 16, 2026 13:54
@jeqo jeqo requested a review from Copilot March 16, 2026 13:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the diskless-topic metadata rewriting so that leaderEpoch from the controller is preserved (instead of being reset to 0), maintaining epoch monotonicity expectations for Kafka clients that use epochs for fencing/validation.

Changes:

  • Stop overwriting leaderEpoch in InklessTopicMetadataTransformer for both Metadata and DescribeTopicPartitions responses.
  • Update existing managed-replica tests to set/assert non-zero leaderEpoch.
  • Add explicit tests asserting that leaderEpoch is preserved across both transform paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
storage/inkless/src/main/java/io/aiven/inkless/metadata/InklessTopicMetadataTransformer.java Removes forced INITIAL_LEADER_EPOCH assignment so controller-provided epochs are preserved.
storage/inkless/src/test/java/io/aiven/inkless/metadata/InklessTopicMetadataTransformerTest.java Adjusts assertions and adds dedicated coverage to ensure leader epoch preservation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeqo jeqo marked this pull request as ready for review March 16, 2026 13:58
Copy link
Copy Markdown
Contributor

@viktorsomogyi viktorsomogyi left a comment

Choose a reason for hiding this comment

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

No comments from me, I'd give a chance to @giuseppelillo to add his', if needed.

@giuseppelillo giuseppelillo merged commit 89bf883 into main Mar 16, 2026
14 checks passed
@giuseppelillo giuseppelillo deleted the jeqo/pod-2122-preserve-leader-epoch branch March 16, 2026 15:10
AnatolyPopov pushed a commit that referenced this pull request Mar 23, 2026
…ormer (#539)

Stop resetting leader epoch to INITIAL_LEADER_EPOCH (0) in
InklessTopicMetadataTransformer. Clients depend on epoch monotonicity
for fencing (idempotent producers, consumer offset validation), so
the original epoch from the controller must be preserved.

(cherry picked from commit 89bf883)
jeqo added a commit that referenced this pull request Mar 23, 2026
…ormer (#539)

Stop resetting leader epoch to INITIAL_LEADER_EPOCH (0) in
InklessTopicMetadataTransformer. Clients depend on epoch monotonicity
for fencing (idempotent producers, consumer offset validation), so
the original epoch from the controller must be preserved.
jeqo added a commit that referenced this pull request Mar 23, 2026
…ormer (#539)

Stop resetting leader epoch to INITIAL_LEADER_EPOCH (0) in
InklessTopicMetadataTransformer. Clients depend on epoch monotonicity
for fencing (idempotent producers, consumer offset validation), so
the original epoch from the controller must be preserved.

(cherry picked from commit 89bf883)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants