-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow unknown task time in QueueResizingEsTPE #41810
Allow unknown task time in QueueResizingEsTPE #41810
Conversation
The afterExecute method previously asserted that a TimedRunnable task must have a positive execution time. However, the code in TimedRunnable returns a value of -1 when a task time is unknown. Here, we expand the logic in the assertion to allow for that possibility, and we don't update our task time average if the value is negative. Fixes elastic#41448
Pinging @elastic/es-core-infra |
@elasticmachine run elasticsearch-ci/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good. I think we can make a change to be more explicit though.
@@ -151,8 +151,12 @@ protected void afterExecute(Runnable r, Throwable t) { | |||
final long totalNanos = totalTaskNanos.addAndGet(taskNanos); | |||
|
|||
final long taskExecutionNanos = timedRunnable.getTotalExecutionNanos(); | |||
assert taskExecutionNanos >= 0 : "expected task to always take longer than 0 nanoseconds, got: " + taskExecutionNanos; | |||
executionEWMA.addValue(taskExecutionNanos); | |||
assert taskExecutionNanos >= 0 || taskExecutionNanos == -1 : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit paranoid about things. I'd prefer if we also tracked if an exception occurred with a boolean that gets updated in the onRejection
and onFailure
methods. Then we can say for certain that a taskExecutionNanos of -1 was really due to an exception.
In order to be sure that a task has an execution time of -1 because of a failure, I'm adding a failure flag boolean to the TimedRunnable class. If execution time is negative for some other reason, an assertion will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Allow unknown task time in QueueResizingEsTPE The afterExecute method previously asserted that a TimedRunnable task must have a positive execution time. However, the code in TimedRunnable returns a value of -1 when a task time is unknown. Here, we expand the logic in the assertion to allow for that possibility, and we don't update our task time average if the value is negative. Fixes #41448 * Add a failure flag to TimedRunnable In order to be sure that a task has an execution time of -1 because of a failure, I'm adding a failure flag boolean to the TimedRunnable class. If execution time is negative for some other reason, an assertion will fail.
* elastic/master: (50 commits) Cleanup versioned deprecations in analysis (elastic#41560) Allow unknown task time in QueueResizingEsTPE (elastic#41810) SQL: Remove CircuitBreaker from parser (elastic#41835) [DOCS] Fix callouts for dataframe APIs (elastic#41904) Handle serialization exceptions during publication (elastic#41781) Correct spelling of MockLogAppender.PatternSeenEventExpectation (elastic#41893) Update TLS ciphers and protocols for JDK 11 (elastic#41808) Remove Harmful Exists Check from BlobStoreFormat (elastic#41898) Fix fractional seconds for strict_date_optional_time (elastic#41871) Remove op.name configuration setting (elastic#41445) Reject port ranges in `discovery.seed_hosts` (elastic#41404) [ML-DataFrame] migrate to PageParams for get and stats, move PageParams into core (elastic#41851) Reenable RareClusterStateIT Mapping Propagation Tests (elastic#41884) [DOCS] Rewrite `exists` query docs (elastic#41868) Revert "Mute MinimumMasterNodesIT.testThreeNodesNoMasterBlock()" [DOCS] Fix typo referring to multi search API Provide names for all artifact repositories (elastic#41857) Move InternalAggregations to Writeable (elastic#41841) Fix compilation after incorrect merge Unmute TestClustersPluginIT.testMultiNode (elastic#41340) ...
* Allow unknown task time in QueueResizingEsTPE The afterExecute method previously asserted that a TimedRunnable task must have a positive execution time. However, the code in TimedRunnable returns a value of -1 when a task time is unknown. Here, we expand the logic in the assertion to allow for that possibility, and we don't update our task time average if the value is negative. * Add a failure flag to TimedRunnable In order to be sure that a task has an execution time of -1 because of a failure, I'm adding a failure flag boolean to the TimedRunnable class. If execution time is negative for some other reason, an assertion will fail. Backport of elastic#41810 Fixes elastic#41448
* Allow unknown task time in QueueResizingEsTPE The afterExecute method previously asserted that a TimedRunnable task must have a positive execution time. However, the code in TimedRunnable returns a value of -1 when a task time is unknown. Here, we expand the logic in the assertion to allow for that possibility, and we don't update our task time average if the value is negative. * Add a failure flag to TimedRunnable In order to be sure that a task has an execution time of -1 because of a failure, I'm adding a failure flag boolean to the TimedRunnable class. If execution time is negative for some other reason, an assertion will fail. Backport of #41810 Fixes #41448
* Allow unknown task time in QueueResizingEsTPE The afterExecute method previously asserted that a TimedRunnable task must have a positive execution time. However, the code in TimedRunnable returns a value of -1 when a task time is unknown. Here, we expand the logic in the assertion to allow for that possibility, and we don't update our task time average if the value is negative. Fixes elastic#41448 * Add a failure flag to TimedRunnable In order to be sure that a task has an execution time of -1 because of a failure, I'm adding a failure flag boolean to the TimedRunnable class. If execution time is negative for some other reason, an assertion will fail.
The afterExecute method previously asserted that a TimedRunnable task
must have a positive execution time. However, the code in TimedRunnable
returns a value of -1 when a task time is unknown. Here, we expand the
logic in the assertion to allow for that possibility, and we don't
update our task time average if the value is negative.
Fixes #41448