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

[GitHub] [kafka] rittikaadhikari opened a new pull request, #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

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

   This PR builds off of KAFKA-14685 and refactors any tests explicitly related to `ReplicaFetcherTierStateMachine` into a separate testing file `ReplicaFetcherTierStateMachineTest`.


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


[GitHub] [kafka] rittikaadhikari commented on pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

Posted by "rittikaadhikari (via GitHub)" <gi...@apache.org>.
rittikaadhikari commented on PR #13503:
URL: https://github.com/apache/kafka/pull/13503#issuecomment-1673867152

   @junrao Thanks for the review! I have addressed the comment.


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


[GitHub] [kafka] rittikaadhikari commented on pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

Posted by "rittikaadhikari (via GitHub)" <gi...@apache.org>.
rittikaadhikari commented on PR #13503:
URL: https://github.com/apache/kafka/pull/13503#issuecomment-1526783446

   @junrao Test failures appear to be unrelated; locally, I'm able to build with JDK 11 and Scala 2.13, and the build failure here seems to be because of `:rat`. I believe this should not be due to my change.


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


[GitHub] [kafka] junrao commented on a diff in pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

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


##########
core/src/test/scala/unit/kafka/server/ReplicaFetcherTierStateMachineTest.scala:
##########
@@ -0,0 +1,136 @@
+/*
+ * 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.server
+
+

Review Comment:
   extra new line



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


[GitHub] [kafka] junrao commented on a diff in pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

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


##########
core/src/test/scala/unit/kafka/server/ReplicaFetcherTierStateMachineTest.scala:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.server
+
+import kafka.cluster.BrokerEndPoint
+import org.apache.kafka.common.errors.FencedLeaderEpochException
+import org.apache.kafka.common.message.FetchResponseData
+import org.apache.kafka.common.protocol.ApiKeys
+import org.apache.kafka.common.record._
+import org.apache.kafka.common.{TopicPartition, Uuid}
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.Test
+
+import scala.collection.Map
+import scala.jdk.CollectionConverters._
+
+class ReplicaFetcherTierStateMachineTest {
+
+  val truncateOnFetch = true
+  val topicIds = Map("topic1" -> Uuid.randomUuid(), "topic2" -> Uuid.randomUuid())
+  val version = ApiKeys.FETCH.latestVersion()
+  private val failedPartitions = new FailedPartitions
+
+  private def mkBatch(baseOffset: Long, leaderEpoch: Int, records: SimpleRecord*): RecordBatch = {

Review Comment:
   It seems that `mkBatch` and `initialFetchState` are not duplicated from AbstractFetcherThreadTest. Could we put them in a util class and reuse?



##########
core/src/test/scala/unit/kafka/server/ReplicaFetcherTierStateMachineTest.scala:
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.server
+
+import kafka.cluster.BrokerEndPoint
+import org.apache.kafka.common.errors.FencedLeaderEpochException
+import org.apache.kafka.common.message.FetchResponseData
+import org.apache.kafka.common.protocol.ApiKeys
+import org.apache.kafka.common.record._
+import org.apache.kafka.common.{TopicPartition, Uuid}
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.Test
+
+import scala.collection.Map
+import scala.jdk.CollectionConverters._
+
+class ReplicaFetcherTierStateMachineTest {
+
+  val truncateOnFetch = true
+  val topicIds = Map("topic1" -> Uuid.randomUuid(), "topic2" -> Uuid.randomUuid())
+  val version = ApiKeys.FETCH.latestVersion()
+  private val failedPartitions = new FailedPartitions
+
+  private def mkBatch(baseOffset: Long, leaderEpoch: Int, records: SimpleRecord*): RecordBatch = {

Review Comment:
   It seems that `mkBatch` and `initialFetchState` are now duplicated from AbstractFetcherThreadTest. Could we put them in a util class and reuse?



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


[GitHub] [kafka] github-actions[bot] commented on pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13503:
URL: https://github.com/apache/kafka/pull/13503#issuecomment-1664922197

   This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has  merge conflicts, please update it with the latest from trunk (or appropriate release branch) <p> If this PR is no longer valid or desired, please feel free to close it. If no activity occurrs in the next 30 days, it will be automatically closed.


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


[GitHub] [kafka] junrao commented on a diff in pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

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


##########
core/src/test/scala/unit/kafka/server/FetcherThreadTestUtils.scala:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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 unit.kafka.server

Review Comment:
   unit.kafka.server => kafka.server ?



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


[GitHub] [kafka] rittikaadhikari commented on pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

Posted by "rittikaadhikari (via GitHub)" <gi...@apache.org>.
rittikaadhikari commented on PR #13503:
URL: https://github.com/apache/kafka/pull/13503#issuecomment-1505826616

   @junrao when you get a chance, would you be free to take a quick pass?


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


[GitHub] [kafka] junrao merged pull request #13503: MINOR: Refactor TierStateMachine related tests into a separate test file

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


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