gaurav-narula commented on code in PR #22977:
URL: https://github.com/apache/kafka/pull/22977#discussion_r3667799047


##########
core/src/test/scala/unit/kafka/server/KafkaConfigTest.scala:
##########
@@ -1709,6 +1709,36 @@ class KafkaConfigTest {
     assertEquals("3", originals.get(KRaftConfigs.NODE_ID_CONFIG))
   }
 
+  @Test
+  def testBrokerIdDeprecationWarning(): Unit = {
+    val deprecationWarning = "The 'broker.id' configuration is deprecated and 
will be removed in " +
+      "Apache Kafka 5.0. Please use 'node.id' instead."
+
+    // Register on the KafkaConfig logger rather than the root logger, so that 
the warning is only
+    // captured if it is actually logged by `object KafkaConfig`.
+    Using.resource(LogCaptureAppender.createAndRegister(KafkaConfig.getClass)) 
{ appender =>
+      appender.setClassLogger(KafkaConfig.getClass, Level.WARN)
+      // The appender cannot be reset, so the counts asserted below are 
cumulative.
+      def warningCount: Int = appender.getMessages.asScala.count(_ == 
deprecationWarning)
+
+      // Only node.id set: no warning.
+      val props = new Properties()
+      props.putAll(kraftProps())
+      KafkaConfig.fromProps(props)

Review Comment:
   Please consider parameterising this against doLog



##########
storage/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogManager.java:
##########
@@ -399,6 +399,7 @@ RemoteStorageManager createRemoteStorageManager() {
         });
     }
 
+    @SuppressWarnings("removal") // revisit when broker.id is removed from 
CONFIG_DEF in 5.0 (KIP-1232)
     private Plugin<RemoteStorageManager> 
configAndWrapRsmPlugin(RemoteStorageManager rsm) {
         final Map<String, Object> rsmProps = new 
HashMap<>(rlmConfig.remoteStorageManagerProps());
         rsmProps.put(ServerConfigs.BROKER_ID_CONFIG, brokerId);

Review Comment:
   Can you please share why this isn't updated to use `node.id` instead?



##########
storage/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogManager.java:
##########


Review Comment:
   Same here



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

Reply via email to