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

Kuan Po Tseng edited comment on KAFKA-17235 at 8/1/24 2:35 PM:
---------------------------------------------------------------

The root cause of this issue is a change we introduced in KAFKA-16879, where we 
modified the {{PushHttpMetricsReporter}} constructor to use {{Time.System}} 
{+}[1]{+}. However, {{Time.System}} doesn't exist in Kafka versions 0.8.2 and 
0.9.

In {{{}test_performance_services.py{}}}, we have system tests for Kafka 
versions 0.8.2 and 0.9 {+}[2]{+}. These tests always use the tools JAR from the 
trunk branch, regardless of the Kafka version being tested {+}[3]{+}, while the 
client JAR aligns with the Kafka version specified in the test suite {+}[4]{+}. 
This discrepancy is what causes the issue to arise.

To resolve this issue, we have a few options:
 # Add {{Time.System}} to Kafka 0.8.2 and 0.9: This isn't practical, as we no 
longer maintain these versions.
 # Modify the {{PushHttpMetricsReporter}} constructor to use {{new 
SystemTime()}} instead of {{{}Time.System{}}}: This would contradict the intent 
of KAFKA-16879, which aims to make {{SystemTime}} a singleton.
 # Remove system tests for Kafka 0.8.2 and 0.9 from 
{{test_performance_services.py}}

Given that we no longer maintain Kafka 0.8.2 and 0.9, and altering the 
constructor goes against the design goals of KAFKA-16879, option 3 appears to 
be the most feasible solution. However, I'm not sure whether it's acceptable to 
remove these old version tests. Maybe someone else has a better solution :)

[1] 
[https://github.com/apache/kafka/blob/133f2b0f311ba1fd5a999f477bad38370c1772ca/tools/src/main/java/org/apache/kafka/tools/PushHttpMetricsReporter.java#L99]
[2] 
[https://github.com/apache/kafka/blob/0711d1558250c60807dfa815d46907eac8bb4b98/tests/kafkatest/sanity_checks/test_performance_services.py#L43-L44]
[3] 
[https://github.com/apache/kafka/blob/0711d1558250c60807dfa815d46907eac8bb4b98/tests/kafkatest/services/performance/producer_performance.py#L89]
[4] 
[https://github.com/apache/kafka/blob/0711d1558250c60807dfa815d46907eac8bb4b98/tests/kafkatest/services/performance/producer_performance.py#L80]


was (Author: brandboat):
The root cause of this issue is a change we introduced in KAFKA-16879, where we 
modified the {{PushHttpMetricsReporter}} constructor to use {{Time.System}} 
{+}[1]{+}. However, {{Time.System}} doesn't exist in Kafka versions 0.8.2 and 
0.9.

In {{{}test_performance_services.py{}}}, we have system tests for Kafka 
versions 0.8.2 and 0.9 {+}[2]{+}. These tests always use the tools JAR from the 
trunk branch, regardless of the Kafka version being tested {+}[3]{+}, while the 
client JAR aligns with the Kafka version specified in the test suite {+}[4]{+}. 
This discrepancy is what causes the issue to arise.

To resolve this issue, we have a few options:
 # Add {{Time.System}} to Kafka 0.8.2 and 0.9: This isn't practical, as we no 
longer maintain these versions.
 # Modify the {{PushHttpMetricsReporter}} constructor to use {{new 
SystemTime()}} instead of {{{}Time.System{}}}: This would contradict the intent 
of KAFKA-16879, which aims to make {{SystemTime}} a singleton.
 # Remove system tests for Kafka 0.8.2 and 0.9 from 
{{test_performance_services.py}}

Given that we no longer maintain Kafka 0.8.2 and 0.9, and altering the 
constructor goes against the design goals of KAFKA-16879, option 3 appears to 
be the most feasible solution. However, I'm not sure whether it's acceptable to 
remove these old version tests or if maintaining backward compatibility is a 
priority. Maybe someone else has a better solution :)

[1] 
[https://github.com/apache/kafka/blob/133f2b0f311ba1fd5a999f477bad38370c1772ca/tools/src/main/java/org/apache/kafka/tools/PushHttpMetricsReporter.java#L99]
[2] 
[https://github.com/apache/kafka/blob/0711d1558250c60807dfa815d46907eac8bb4b98/tests/kafkatest/sanity_checks/test_performance_services.py#L43-L44]
[3] 
[https://github.com/apache/kafka/blob/0711d1558250c60807dfa815d46907eac8bb4b98/tests/kafkatest/services/performance/producer_performance.py#L89]
[4] 
[https://github.com/apache/kafka/blob/0711d1558250c60807dfa815d46907eac8bb4b98/tests/kafkatest/services/performance/producer_performance.py#L80]

> system test test_performance_service.py failed
> ----------------------------------------------
>
>                 Key: KAFKA-17235
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17235
>             Project: Kafka
>          Issue Type: Bug
>          Components: system tests
>            Reporter: Kuan Po Tseng
>            Assignee: Kuan Po Tseng
>            Priority: Major
>         Attachments: 2024-08-01--001.zip, image-2024-08-01-22-31-47-649.png
>
>
> After run
> {code:java}
> TC_PATHS="tests/kafkatest/sanity_checks/test_performance_services.py" bash 
> tests/docker/run_tests.sh
> {code}
> There are three failed test cases:
> kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=0.8.2.2.new_consumer=False
> kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=0.9.0.1
> kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=0.9.0.1.new_consumer=False
> And in each failed test case, in producer_performance.stderr I saw error
> {code:java}
> Exception in thread "main" java.lang.NoSuchFieldError: SYSTEM
>       at 
> org.apache.kafka.tools.PushHttpMetricsReporter.<init>(PushHttpMetricsReporter.java:99)
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>       at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>       at java.lang.Class.newInstance(Class.java:442)
>       at org.apache.kafka.common.utils.Utils.newInstance(Utils.java:231)
>       at 
> org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:156)
>       at 
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:168)
>       at 
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:129)
>       at 
> org.apache.kafka.tools.ProducerPerformance.createKafkaProducer(ProducerPerformance.java:175)
>       at 
> org.apache.kafka.tools.ProducerPerformance.start(ProducerPerformance.java:86)
>       at 
> org.apache.kafka.tools.ProducerPerformance.main(ProducerPerformance.java:52){code}



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

Reply via email to