MINOR: Fix handling of dummy record in EndToEndLatency tool - #5950
MINOR: Fix handling of dummy record in EndToEndLatency tool#5950apovzner wants to merge 3 commits into
Conversation
|
|
||
| // sends a dummy message to create the topic if it doesn't exist | ||
| producer.send(new ProducerRecord[Array[Byte], Array[Byte]](topic, Array[Byte]())).get() | ||
| val dummyRecord = producer.send(new ProducerRecord[Array[Byte], Array[Byte]](topic, Array[Byte]())).get() |
There was a problem hiding this comment.
Any reason not to just switch to AdminClient and validate topic creation before proceeding? It seems like this wasn't mentioned in the previous discussion on the PR that introduced this dummy message, but maybe I scanned over it too quickly.
I think we may have done it this way to preserve the functionality in that we wouldn't fail on a cluster with topic auto creation, but arguably the old implementation pre-dummyRecord was simply buggy since at least the first message would incur the topic creation overhead and skew results. Main reason for being careful about changing it is that failing fast would result in an error exit status rather than just skewed results. On the other hand, this code doesn't even work with a topic without auto topic creation on, even if the principal has topic creation permissions, so I'm not sure this is really the right behavior either.
@hachikuji, looks like you reviewed the previous update. Thoughts?
There was a problem hiding this comment.
Yeah, using the AdminClient seems preferable over relying on auto topic creation. One disadvantage is that clusters older than 0.10.1 would no longer be supported unless the topic was created manually. But this seems OK since creating the topic manually is not a big deal if someone was trying to compare the performance of very old clusters.
There was a problem hiding this comment.
There was no reason not to use AdminClient, except trying to preserve the functionality as closely as possible. However, after reading comments on the previous PR (5319), it seems like the behavior was not really well defined. So, I agree with using AdminClient for topic creation. I changed the code to check if topic exists and use AdminClient to create the topic.
ewencp
left a comment
There was a problem hiding this comment.
I'm basically +1 other than an issue with AdminClient props.
great catch by the way, this seems like it would be a difficult issue to track down!
| println("Topic \"%s\" does not exist. Will create topic with %d partition(s) and replication factor = %d" | ||
| .format(topic, defaultNumPartitions, defaultReplicationFactor)) | ||
|
|
||
| val props = new Properties() |
There was a problem hiding this comment.
I think you want to loadProps here like the producer and consumer do. Otherwise this wouldn't work with, e.g. security. Not sure if we're actually leveraging extra props anywhere, but I think we probably want to be consistent.
There was a problem hiding this comment.
Ah good point about security and consistency. Will fix.
|
oh, also @apovzner any idea how far back this should be cherry-picked? |
|
JDK 8 build failure looks unrelated to this change: kafka.admin.ResetConsumerGroupOffsetTest > testResetOffsetsNotExistingGroup: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.CoordinatorNotAvailableException: The coordinator is not available. retest this please |
|
@ewencp Thanks for the review. I addressed the AdminClient issue and updated the PR. About how far back this should be cherry-picked, definitely to 2.1.0. We need this in earlier versions as well, at least back to 1.0. However, earlier versions do not have PR #5319 change, so EndToEndLatency uses different consumer API. I am thinking maybe it is better to open another PR for earlier versions that contain this change and changes to EndToEndLatency in PR #5319? |
|
I suggest just 2.1.0 and trunk. |
|
build failed due to "kafka.server.ListOffsetsRequestTest.testResponseIncludesLeaderEpoch", unrelated. |
|
LGTM! Going to merge to trunk and 2.1. If we want to clear things up for earlier versions as well, we can follow up with another PR. |
EndToEndLatency tool produces a dummy record in case the topic does not exist. This behavior was introduced in this PR #5319 as part of updating the tool to use latest consumer API. However, if we run the tool with producer acks == 1, the high watermark may not be updated before we reset consumer offsets to latest. In rare cases when this happens, the tool will throw an exception in the for loop where the consumer will unexpectedly consume the dummy record. As a result, we occasionally see Benchmark.test_end_to_end_latency system test failures. This PR checks if topic exists, and creates the topic using AdminClient if it does not exist. Author: Anna Povzner <anna@confluent.io> Reviewers: Ismael Juma <ismael@juma.me.uk>, Ewen Cheslack-Postava <ewen@confluent.io> Closes #5950 from apovzner/fix-EndToEndLatency (cherry picked from commit 3acebe6) Signed-off-by: Ewen Cheslack-Postava <me@ewencp.org>
EndToEndLatency tool produces a dummy record in case the topic does not exist. This behavior was introduced in this PR apache#5319 as part of updating the tool to use latest consumer API. However, if we run the tool with producer acks == 1, the high watermark may not be updated before we reset consumer offsets to latest. In rare cases when this happens, the tool will throw an exception in the for loop where the consumer will unexpectedly consume the dummy record. As a result, we occasionally see Benchmark.test_end_to_end_latency system test failures. This PR checks if topic exists, and creates the topic using AdminClient if it does not exist. Author: Anna Povzner <anna@confluent.io> Reviewers: Ismael Juma <ismael@juma.me.uk>, Ewen Cheslack-Postava <ewen@confluent.io> Closes apache#5950 from apovzner/fix-EndToEndLatency (cherry picked from commit 3acebe6) Signed-off-by: Ewen Cheslack-Postava <me@ewencp.org>
EndToEndLatency tool produces a dummy record in case the topic does not exist. This behavior was introduced in this PR apache#5319 as part of updating the tool to use latest consumer API. However, if we run the tool with producer acks == 1, the high watermark may not be updated before we reset consumer offsets to latest. In rare cases when this happens, the tool will throw an exception in the for loop where the consumer will unexpectedly consume the dummy record. As a result, we occasionally see Benchmark.test_end_to_end_latency system test failures. This PR checks if topic exists, and creates the topic using AdminClient if it does not exist. Author: Anna Povzner <anna@confluent.io> Reviewers: Ismael Juma <ismael@juma.me.uk>, Ewen Cheslack-Postava <ewen@confluent.io> Closes apache#5950 from apovzner/fix-EndToEndLatency
EndToEndLatency tool produces a dummy record in case the topic does not exist. This behavior was introduced in this PR #5319 as part of updating the tool to use latest consumer API. However, if we run the tool with producer acks == 1, the high watermark may not be updated before we reset consumer offsets to latest. In rare cases when this happens, the tool will throw an exception in the for loop where the consumer will unexpectedly consume the dummy record. As a result, we occasionally see Benchmark.test_end_to_end_latency system test failures.
This PR checks if topic exists, and creates the topic using AdminClient if it does not exist.
Committer Checklist (excluded from commit message)