mumrah commented on code in PR #12033: URL: https://github.com/apache/kafka/pull/12033#discussion_r849822171
########## metadata/src/main/java/org/apache/kafka/metadata/ControllerRequestContext.java: ########## @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.kafka.metadata; Review Comment: Should this go in the controller package? `metadata` looks like mostly POJOs and such used by the controller and broker, while this class seems more controller specific ########## metadata/src/main/java/org/apache/kafka/controller/QuorumController.java: ########## @@ -582,16 +582,17 @@ ReplicationControlManager replicationControl() { return replicationControl; } - // VisibleForTesting - <T> CompletableFuture<T> appendReadEvent(String name, Supplier<T> handler) { - ControllerReadEvent<T> event = new ControllerReadEvent<T>(name, handler); - queue.append(event); - return event.future(); - } - - <T> CompletableFuture<T> appendReadEvent(String name, long deadlineNs, Supplier<T> handler) { + <T> CompletableFuture<T> appendReadEvent( + String name, + OptionalLong deadlineNs, + Supplier<T> handler + ) { ControllerReadEvent<T> event = new ControllerReadEvent<T>(name, handler); - queue.appendWithDeadline(deadlineNs, event); + if (deadlineNs.isPresent()) { + queue.appendWithDeadline(deadlineNs.getAsLong(), event); + } else { + queue.append(event); + } Review Comment: Could you provide some context here. Is this related to the issue with fairness we saw for expired events? ########## core/src/main/scala/kafka/server/ControllerApis.scala: ########## @@ -422,6 +430,8 @@ class ControllerApis(val requestChannel: RequestChannel, def handleLegacyAlterConfigs(request: RequestChannel.Request): Unit = { val response = new AlterConfigsResponseData() val alterConfigsRequest = request.body[AlterConfigsRequest] + val context = new ControllerRequestContext(request.context.principal, + OptionalLong.empty()) Review Comment: nit: this could go on the previous line ########## metadata/src/main/java/org/apache/kafka/controller/QuorumController.java: ########## @@ -1602,13 +1651,21 @@ public CompletableFuture<Long> beginWritingSnapshot() { } @Override - public CompletableFuture<List<AclCreateResult>> createAcls(List<AclBinding> aclBindings) { - return appendWriteEvent("createAcls", () -> aclControlManager.createAcls(aclBindings)); + public CompletableFuture<List<AclCreateResult>> createAcls( + ControllerRequestContext context, + List<AclBinding> aclBindings + ) { + return appendWriteEvent("createAcls", context.deadlineNs(), + () -> aclControlManager.createAcls(aclBindings)); } @Override - public CompletableFuture<List<AclDeleteResult>> deleteAcls(List<AclBindingFilter> filters) { - return appendWriteEvent("deleteAcls", () -> aclControlManager.deleteAcls(filters)); + public CompletableFuture<List<AclDeleteResult>> deleteAcls( + ControllerRequestContext context, + List<AclBindingFilter> filters + ) { Review Comment: If this is the declaration style we prefer, can we enforce it with checkstyle? Specifically I mean the `) {` on its own line. ########## core/src/main/scala/kafka/log/LogConfig.scala: ########## @@ -473,8 +473,8 @@ object LogConfig { FlushMessagesProp -> asList( new ConfigSynonym(KafkaConfig.LogFlushIntervalMessagesProp)), FlushMsProp -> asList( - new ConfigSynonym(KafkaConfig.LogFlushSchedulerIntervalMsProp), - new ConfigSynonym(KafkaConfig.LogFlushIntervalMsProp)), + new ConfigSynonym(KafkaConfig.LogFlushIntervalMsProp), + new ConfigSynonym(KafkaConfig.LogFlushSchedulerIntervalMsProp)), Review Comment: Is this the fix for KAFKA-13807? Did we have the precedence wrong or something? -- 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]
