[jira] [Commented] (KAFKA-16323) Failing test: fix testRemoteFetchExpiresPerSecMetric

2024-03-27 Thread Chia-Ping Tsai (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-16323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17831291#comment-17831291
 ] 

Chia-Ping Tsai commented on KAFKA-16323:


It seems to me the root cause could be the `spy` does not work well. We had met 
similar issue before - the spied method results in unexpected behavior when we 
test it in multi-threads. see https://github.com/apache/kafka/pull/10006

Hence, we can try to fix it by using `override` to replace spied method. for 
example: 

{code}
val latch = new CountDownLatch(1)
val remoteLogManager = new RemoteLogManager(
  remoteLogManagerConfig,
  0,
  TestUtils.tempRelativeDir("data").getAbsolutePath,
  "clusterId",
  time,
  _ => Optional.of(dummyLog),
  (TopicPartition, Long) => {},
  brokerTopicStats) {
  override def read(remoteStorageFetchInfo: RemoteStorageFetchInfo): 
FetchDataInfo = {
// wait until verification completes
latch.await(5000, TimeUnit.MILLISECONDS)
mock(classOf[FetchDataInfo])
  }
}
{code}


> Failing test: fix testRemoteFetchExpiresPerSecMetric 
> -
>
> Key: KAFKA-16323
> URL: https://issues.apache.org/jira/browse/KAFKA-16323
> Project: Kafka
>  Issue Type: Bug
>  Components: core
>Reporter: Johnny Hsu
>Assignee: Johnny Hsu
>Priority: Major
>  Labels: test-failure
>
> Refer to 
> [https://ci-builds.apache.org/job/Kafka/job/kafka/job/trunk/2685/testReport/junit/kafka.server/ReplicaManagerTest/Build___JDK_21_and_Scala_2_13___testRemoteFetchExpiresPerSecMetric__/]
> This test is failing, and this ticket aims to address this 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (KAFKA-16323) Failing test: fix testRemoteFetchExpiresPerSecMetric

2024-03-19 Thread Johnny Hsu (Jira)


[ 
https://issues.apache.org/jira/browse/KAFKA-16323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17828304#comment-17828304
 ] 

Johnny Hsu commented on KAFKA-16323:


I have added logs to observe and tried to verify some potential causes:
 # check whether it really enters the delayed remote fetch
 # check whether it really enters the onExpire() section
 # check whether it succeeds in marking the metrics

All verified and works as expected. 

 

Thanks to [~showuon], I also tried to add @BeforeAll to the tear down function, 
which remove all metrics before the test. However it still failed. 

Need some more tries to find the root causes...

> Failing test: fix testRemoteFetchExpiresPerSecMetric 
> -
>
> Key: KAFKA-16323
> URL: https://issues.apache.org/jira/browse/KAFKA-16323
> Project: Kafka
>  Issue Type: Bug
>  Components: core
>Reporter: Johnny Hsu
>Assignee: Johnny Hsu
>Priority: Major
>  Labels: test-failure
>
> Refer to 
> [https://ci-builds.apache.org/job/Kafka/job/kafka/job/trunk/2685/testReport/junit/kafka.server/ReplicaManagerTest/Build___JDK_21_and_Scala_2_13___testRemoteFetchExpiresPerSecMetric__/]
> This test is failing, and this ticket aims to address this 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)