rondagostino commented on code in PR #14290:
URL: https://github.com/apache/kafka/pull/14290#discussion_r1378929413


##########
metadata/src/main/java/org/apache/kafka/metadata/PartitionRegistration.java:
##########
@@ -102,6 +112,8 @@ public Builder setPartitionEpoch(Integer partitionEpoch) {
         public PartitionRegistration build() {
             if (replicas == null) {
                 throw new IllegalStateException("You must set replicas.");
+            } else if (directories != null && directories.length != 
replicas.length) {
+                throw new IllegalStateException("The lengths for replicas and 
directories do not match.");

Review Comment:
   Noting that  we don't throw `InvalidReplicaDirectoriesException` because 
this is in the Builder as opposed to in an actual record.



##########
metadata/src/main/java/org/apache/kafka/common/errors/InvalidReplicaDirectoriesException.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.common.errors;
+
+import org.apache.kafka.common.metadata.PartitionChangeRecord;
+import org.apache.kafka.common.metadata.PartitionRecord;
+
+/**
+ * A record was encountered where the number of directories does not match the 
number of replicas.
+ */
+public class InvalidReplicaDirectoriesException extends 
InvalidMetadataException {

Review Comment:
   nit: constructors in `InvalidMetadataException` can be made protected to 
eliminate the confusion that we encountered previously in this PR



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to