aloknnikhil commented on a change in pull request #9985:
URL: https://github.com/apache/kafka/pull/9985#discussion_r566314131



##########
File path: core/src/test/scala/unit/kafka/raft/KafkaNetworkChannelTest.scala
##########
@@ -139,6 +145,25 @@ class KafkaNetworkChannelTest {
     }
   }
 
+  @Test
+  def testNonRoutableAddressUpdateRequest(): Unit = {
+    val destinationId = 2
+    assertThrows(classOf[IllegalArgumentException],
+      () => new InetAddressSpec(new InetSocketAddress("0.0.0.0", 0)))

Review comment:
       All the tests in `RaftConfigTest` were migrated to `KafkaConfigTest` in 
an earlier PR. I'll move this also.

##########
File path: core/src/test/scala/unit/kafka/raft/KafkaNetworkChannelTest.scala
##########
@@ -139,6 +145,25 @@ class KafkaNetworkChannelTest {
     }
   }
 
+  @Test
+  def testNonRoutableAddressUpdateRequest(): Unit = {
+    val destinationId = 2
+    assertThrows(classOf[IllegalArgumentException],
+      () => new InetAddressSpec(new InetSocketAddress("0.0.0.0", 0)))
+
+    // Update channel with a valid endpoint

Review comment:
       Fair enough. Removed.

##########
File path: core/src/main/scala/kafka/raft/RaftManager.scala
##########
@@ -118,9 +119,20 @@ class KafkaRaftManager[T](
   private val raftIoThread = new RaftIoThread(raftClient)
 
   def startup(): Unit = {
+    // Update the voter endpoints (if valid) with what's in RaftConfig
+    val voterAddresses: util.Map[Integer, AddressSpec] = 
raftConfig.quorumVoterConnections
+    for (voterAddressEntry <- voterAddresses.entrySet.asScala) {
+      voterAddressEntry.getValue match {
+        case spec: InetAddressSpec => {
+          netChannel.updateEndpoint(voterAddressEntry.getKey, spec)
+        }
+        case invalid: AddressSpec => {
+          logger.warn(s"Skipping channel update for destination ID: 
${voterAddressEntry.getKey} " +

Review comment:
       Ack.




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

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


Reply via email to