ijuma commented on code in PR #18997:
URL: https://github.com/apache/kafka/pull/18997#discussion_r1970567923
##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -2004,14 +2004,17 @@ public CompletableFuture<BrokerRegistrationReply>
registerBroker(
ControllerRequestContext context,
BrokerRegistrationRequestData request
) {
- // populate finalized features map with latest known kraft version for
validation
- Map<String, Short> controllerFeatures = new
HashMap<>(featureControl.finalizedFeatures(Long.MAX_VALUE).featureMap());
- controllerFeatures.put(KRaftVersion.FEATURE_NAME,
raftClient.kraftVersion().featureLevel());
return appendWriteEvent("registerBroker", context.deadlineNs(),
- () -> clusterControl.
- registerBroker(request, offsetControl.nextWriteOffset(),
- new FinalizedControllerFeatures(controllerFeatures,
Long.MAX_VALUE),
- context.requestHeader().requestApiVersion() >= 3),
+ () -> {
+ // Populate finalized features map with latest known kraft
version for validation.
+ // Get the finalized features map in controller operation to
avoid outdated features.
Review Comment:
Isn't the important point that both reads and writes have to happen within
the controller event handling thread (versus the specific finalized features
map part)? Overly specific comments tend to go stale more easily.
--
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]