refactor(metadata:diskless): preserve leader epoch in metadata#539
refactor(metadata:diskless): preserve leader epoch in metadata#539giuseppelillo merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
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
leaderEpochtoINITIAL_LEADER_EPOCHduring metadata/describe transformations. - Dropped the now-unused
LeaderAndIsrdependency/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.
...age/inkless/src/test/java/io/aiven/inkless/metadata/InklessTopicMetadataTransformerTest.java
Show resolved
Hide resolved
…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.
9f8bcfa to
29a7884
Compare
There was a problem hiding this comment.
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
leaderEpochinInklessTopicMetadataTransformerfor both Metadata and DescribeTopicPartitions responses. - Update existing managed-replica tests to set/assert non-zero
leaderEpoch. - Add explicit tests asserting that
leaderEpochis 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.
There was a problem hiding this comment.
No comments from me, I'd give a chance to @giuseppelillo to add his', if needed.
…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)
…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.
…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)
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.