KAFKA-12867: Fix ConsumeBenchWorker exit behavior for maxMessages config#10797
Merged
rajinisivaram merged 1 commit intoapache:trunkfrom Jun 2, 2021
Merged
Conversation
Contributor
Author
|
cc @junrao @apovzner @rajinisivaram for review. @apovzner It appears this behavior has been around since |
rajinisivaram
approved these changes
Jun 2, 2021
Contributor
rajinisivaram
left a comment
There was a problem hiding this comment.
@kowshik Thanks for the PR, LGTM. Test failures not related, merging to trunk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug:
The trogdor
ConsumeBenchWorkerhas a bug. It allows several consumption tasks to be run in parallel, the number is configurable using thethreadsPerWorkerconfig. If one of the consumption tasks completes executing successfully due tomaxMessagesbeing consumed, then, the consumption task prematurely notifies thedoneFuturecausing the entireConsumeBenchWorkerto halt. This becomes a problem when more than 1 consumption task is running in parallel, because the successful completion of 1 of the tasks shuts down the entire worker while the other tasks are still running. When the worker is shut down, it kills all the active consumption tasks, though they have not consumedmaxMessagesyet. This is not the desired behavior.How to reproduce?:
The bug is easily reproducible by running a
ConsumeBenchSpectask configured withmaxMessagesvalue andthreadsPerWorker> 1. When a trogdor workload is started with such a spec, and when one of the threads (i.e. consumption task) has consumedmaxMessages, you can notice that it prematurely shuts down the worker although the other threads have not yet consumed at leastmaxMessages.Fix:
The fix is to defer the notification of the
doneFutureto theCloseStatusUpdaterthread. This thread is already responsible for tracking the status of the tasks and updating their status when all of the tasks complete, so this seems like the right place to inject thedoneFuturenotification.