gharris1727 commented on code in PR #13277:
URL: https://github.com/apache/kafka/pull/13277#discussion_r1619177795


##########
clients/src/main/java/org/apache/kafka/clients/MetadataRecoveryStrategy.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.clients;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.NoSuchElementException;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Defines the strategies which clients can follow to deal with the situation 
when none of the known nodes is available.
+ */
+public enum MetadataRecoveryStrategy {
+    NONE("none"),
+    REBOOTSTRAP("rebootstrap");
+
+    public final String name;
+
+    MetadataRecoveryStrategy(String name) {
+        this.name = name;
+    }
+
+    private static final List<MetadataRecoveryStrategy> VALUES = 
asList(values());

Review Comment:
   nit: this is unused



##########
clients/src/main/java/org/apache/kafka/clients/MetadataRecoveryStrategy.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.clients;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.NoSuchElementException;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Defines the strategies which clients can follow to deal with the situation 
when none of the known nodes is available.
+ */
+public enum MetadataRecoveryStrategy {
+    NONE("none"),
+    REBOOTSTRAP("rebootstrap");
+
+    public final String name;
+
+    MetadataRecoveryStrategy(String name) {
+        this.name = name;
+    }
+
+    private static final List<MetadataRecoveryStrategy> VALUES = 
asList(values());
+
+    public static MetadataRecoveryStrategy forName(String n) {
+        String name = n.toLowerCase(Locale.ROOT);

Review Comment:
   nit: this can NPE if the input is null. This currently can't happen, but it 
would be nice to get the same exception type for all invalid inputs.



##########
core/src/test/scala/integration/kafka/api/RebootstrapTest.scala:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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 kafka.api
+
+import kafka.server.{KafkaConfig, KafkaServer}
+import org.apache.kafka.clients.CommonClientConfigs
+import org.apache.kafka.common.config.TopicConfig
+import org.apache.kafka.coordinator.group.GroupCoordinatorConfig
+
+import java.util.Properties
+
+abstract class RebootstrapTest extends AbstractConsumerTest {
+  override def brokerCount: Int = 2
+
+  def server0: KafkaServer = serverForId(0).get
+  def server1: KafkaServer = serverForId(1).get
+
+  override def generateConfigs: Seq[KafkaConfig] = {
+    val overridingProps = new Properties()
+    
overridingProps.put(GroupCoordinatorConfig.OFFSETS_TOPIC_REPLICATION_FACTOR_CONFIG,
 brokerCount.toString)
+    overridingProps.put(TopicConfig.UNCLEAN_LEADER_ELECTION_ENABLE_CONFIG, 
"true")
+
+    // In this test, fixed ports are necessary, because brokers must have the
+    // same port after the restart.
+    FixedPortTestUtils.createBrokerConfigs(brokerCount, zkConnect, 
enableControlledShutdown = false)

Review Comment:
   If Kafka had a development-only option to reuse addresses, we could reserve 
ports ahead-of-time, and have the broker startup just rebind the address.



-- 
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