You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/06/01 21:42:34 UTC

[GitHub] [kafka] jsancio commented on a diff in pull request #12195: MINOR: implement BrokerRegistrationChangeRecord

jsancio commented on code in PR #12195:
URL: https://github.com/apache/kafka/pull/12195#discussion_r887311146


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -1271,6 +1271,9 @@ private void replay(ApiMessage message, Optional<OffsetAndEpoch> snapshotId, lon
                 case PRODUCER_IDS_RECORD:
                     producerIdControlManager.replay((ProducerIdsRecord) message);
                     break;
+                case BROKER_REGISTRATION_CHANGE_RECORD:
+                    clusterControl.replay((BrokerRegistrationChangeRecord) message);
+                    break;

Review Comment:
   @cmccabe I think you missed this comment:
   > Don't we also need broker side changes. At a minimum don't we need to change MetadataDelta#replay? Do we need an integration test that shows that controllers and brokers support this record?
   
   from https://github.com/apache/kafka/pull/12195#pullrequestreview-985201342



##########
server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java:
##########
@@ -155,7 +155,8 @@ public enum MetadataVersion {
     // Support for metadata.version feature flag and Removes min_version_level from the finalized version range that is written to ZooKeeper (KIP-778)
     IBP_3_3_IV0(5, "3.3", "IV0", false),
 
-    // Support NoopRecord for the cluster metadata log (KIP-835)
+    // In KRaft mode, use BrokerRegistrationChangeRecord instead of UnfenceBrokerRecord and FenceBrokerRecord.
+    // Also, use NoopRecord as specified in KIP-835.

Review Comment:
   In general, do we want to decouple metadata versions from Kafka releases? For example, should we add this version instead of reusing `IBP_3_3_IV1`?
   ```
        IBP_3_3_IV2(7, "3.3", "IV2", true);
   ```
   My understanding is that for IBP, Kafka added IVX so that users can deploy clusters from trunk and perform upgrade on clusters from trunk. cc @mumrah 



##########
metadata/src/main/java/org/apache/kafka/metadata/BrokerRegistrationFencingChange.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+
+public enum BrokerRegistrationFencingChange {
+    REMOVED(-1, Optional.of(false)),
+    UNCHANGED(0, Optional.empty()),
+    ADDED(1, Optional.of(true));

Review Comment:
   Maybe we should add JavaDoc comments to these enums. This is the documentation for that record:
   > -1 if the broker has been unfenced, 0 if no change, 1 if the broker has been fenced.
   
   I was interpreting REMOVED and ADDED as being removed from or added to the cluster. But it looks like we mean getting added to or removed from the fence state. The other option is to call this enum values FENCED, UNFENCED and NO_CHANGE. What do you think?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org