OmniaGM commented on code in PR #24034:
URL: https://github.com/apache/kafka/pull/24034#discussion_r4475132747
##########
metadata/src/main/java/org/apache/kafka/metadata/PartitionRegistration.java:
##########
@@ -249,14 +250,16 @@ public PartitionRegistration merge(PartitionChangeRecord
record) {
int[] newAddingReplicas = (record.addingReplicas() == null) ?
addingReplicas : Replicas.toArray(record.addingReplicas());
- int newLeader;
+ int newLeader = (record.leader() == NO_LEADER_CHANGE) ? leader :
record.leader();
int newLeaderEpoch;
- if (record.leader() == NO_LEADER_CHANGE) {
- newLeader = leader;
- newLeaderEpoch = leaderEpoch;
- } else {
- newLeader = record.leader();
+ if (record.leaderEpoch() != NO_LEADER_EPOCH_CHANGE) {
+ // Since version 3, the controller sets the new leader epoch in
the record.
+ newLeaderEpoch = record.leaderEpoch();
Review Comment:
Small one: since `merge` now trusts the epoch from the record, a record with
an epoch lower than the current one would silently move it backwards, and
fencing relies on epochs only increasing. Do we want a sanity check here (or in
the controller when the epoch is set explicitly)? Fine as a follow-up with the
`BumpLeaderEpochs` change, WDYT?
##########
server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java:
##########
@@ -140,8 +140,14 @@ public enum MetadataVersion {
// Please move this comment when updating the LATEST_PRODUCTION constant.
//
- // Add support for request header v3 (KIP-1313)
- IBP_4_5_IV0(34, "4.5", "IV0", false);
+ // New version for the Kafka 4.5.0 release.
Review Comment:
Just to clarify, was changing this comment intentional? I think IBP_4_5_IV0
still gates request header v3 (`isRequestHeaderV3Supported()`), so we'd lose
the KIP-1313 reference here. Could we keep the original comment?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]