You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "tinaselenge (via GitHub)" <gi...@apache.org> on 2023/11/02 17:24:33 UTC

[PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

tinaselenge opened a new pull request, #14693:
URL: https://github.com/apache/kafka/pull/14693

   
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "mimaison (via GitHub)" <gi...@apache.org>.
mimaison merged PR #14693:
URL: https://github.com/apache/kafka/pull/14693


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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "linzihao1999 (via GitHub)" <gi...@apache.org>.
linzihao1999 commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1389074590


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -212,7 +228,7 @@ class LogRecoveryTest extends QuorumTestHarness {
     server2.startup()
     updateProducer()
     // check if leader moves to the other server
-    leader = waitUntilLeaderIsElectedOrChanged(zkClient, topic, partitionId, oldLeaderOpt = Some(leader))
+    leader = awaitLeaderChange(servers, topicPartition, leader)

Review Comment:
   I think waitUntilLeaderIsElectedOrChangedWithAdmin can use to instead of it.



##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -78,15 +84,20 @@ class LogRecoveryTest extends QuorumTestHarness {
   override def setUp(testInfo: TestInfo): Unit = {
     super.setUp(testInfo)
 
-    configs = TestUtils.createBrokerConfigs(2, zkConnect, enableControlledShutdown = false).map(KafkaConfig.fromProps(_, overridingProps))
+    configs = TestUtils.createBrokerConfigs(2, zkConnectOrNull, enableControlledShutdown = false).map(KafkaConfig.fromProps(_, overridingProps))
 
     // start both servers
-    server1 = TestUtils.createServer(configProps1)
-    server2 = TestUtils.createServer(configProps2)
+    server1 = createBroker(configProps1)
+    server2 = createBroker(configProps2)
     servers = List(server1, server2)
 
     // create topic with 1 partition, 2 replicas, one on each broker
-    createTopic(zkClient, topic, partitionReplicaAssignment = Map(0 -> Seq(0,1)), servers = servers)
+    if (isKRaftTest()) {
+      admin = createAdminClient(servers, ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT))
+      createTopicWithAdmin(admin, topic, servers, 2, replicaAssignment = Map(0 -> Seq(0, 1)))
+    } else {
+      createTopic(zkClient, topic, partitionReplicaAssignment = Map(0 -> Seq(0, 1)), servers = servers)
+    }

Review Comment:
   I think createTopicWithAdmin includes ZK and KRaft mode, and no need to use `isKRaftTest` to explicitly determine it.



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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "linzihao1999 (via GitHub)" <gi...@apache.org>.
linzihao1999 commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1389074063


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -212,7 +228,7 @@ class LogRecoveryTest extends QuorumTestHarness {
     server2.startup()
     updateProducer()
     // check if leader moves to the other server
-    leader = waitUntilLeaderIsElectedOrChanged(zkClient, topic, partitionId, oldLeaderOpt = Some(leader))
+    leader = awaitLeaderChange(servers, topicPartition, leader)

Review Comment:
   I think waitUntilLeaderIsElectedOrChangedWithAdmin can use to instead of it



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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "linzihao1999 (via GitHub)" <gi...@apache.org>.
linzihao1999 commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1389074063


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -212,7 +228,7 @@ class LogRecoveryTest extends QuorumTestHarness {
     server2.startup()
     updateProducer()
     // check if leader moves to the other server
-    leader = waitUntilLeaderIsElectedOrChanged(zkClient, topic, partitionId, oldLeaderOpt = Some(leader))
+    leader = awaitLeaderChange(servers, topicPartition, leader)

Review Comment:
   I think waitUntilLeaderIsElectedOrChangedWithAdmin can use to instead of it



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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "tinaselenge (via GitHub)" <gi...@apache.org>.
tinaselenge commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1407647882


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -78,15 +84,20 @@ class LogRecoveryTest extends QuorumTestHarness {
   override def setUp(testInfo: TestInfo): Unit = {
     super.setUp(testInfo)
 
-    configs = TestUtils.createBrokerConfigs(2, zkConnect, enableControlledShutdown = false).map(KafkaConfig.fromProps(_, overridingProps))
+    configs = TestUtils.createBrokerConfigs(2, zkConnectOrNull, enableControlledShutdown = false).map(KafkaConfig.fromProps(_, overridingProps))
 
     // start both servers
-    server1 = TestUtils.createServer(configProps1)
-    server2 = TestUtils.createServer(configProps2)
+    server1 = createBroker(configProps1)
+    server2 = createBroker(configProps2)
     servers = List(server1, server2)
 
     // create topic with 1 partition, 2 replicas, one on each broker
-    createTopic(zkClient, topic, partitionReplicaAssignment = Map(0 -> Seq(0,1)), servers = servers)
+    if (isKRaftTest()) {
+      admin = createAdminClient(servers, ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT))
+      createTopicWithAdmin(admin, topic, servers, 2, replicaAssignment = Map(0 -> Seq(0, 1)))
+    } else {
+      createTopic(zkClient, topic, partitionReplicaAssignment = Map(0 -> Seq(0, 1)), servers = servers)
+    }

Review Comment:
   good point. I have addressed this now. Thank you. 



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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "tinaselenge (via GitHub)" <gi...@apache.org>.
tinaselenge commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1407649223


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -212,7 +228,7 @@ class LogRecoveryTest extends QuorumTestHarness {
     server2.startup()
     updateProducer()
     // check if leader moves to the other server
-    leader = waitUntilLeaderIsElectedOrChanged(zkClient, topic, partitionId, oldLeaderOpt = Some(leader))
+    leader = awaitLeaderChange(servers, topicPartition, leader)

Review Comment:
   Is there a reason `awaitLeaderChange` cannot be used? It seems to be much quicker than `waitUntilLeaderIsElectedOrChangedWithAdmin` which does describeTopics(). 



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


Re: [PR] KAFKA-15711: KRaft support in LogRecoveryTest [kafka]

Posted by "linzihao1999 (via GitHub)" <gi...@apache.org>.
linzihao1999 commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1426141060


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -212,7 +228,7 @@ class LogRecoveryTest extends QuorumTestHarness {
     server2.startup()
     updateProducer()
     // check if leader moves to the other server
-    leader = waitUntilLeaderIsElectedOrChanged(zkClient, topic, partitionId, oldLeaderOpt = Some(leader))
+    leader = awaitLeaderChange(servers, topicPartition, leader)

Review Comment:
   I took quick look at code, and i think you are right.



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