Make parallel query-cycle reporting deterministic#157343
Draft
xmakro wants to merge 2 commits into
Draft
Conversation
When the parallel front-end detects a query cycle, the deadlock handler collects the active query jobs in a nondeterministic order. process_cycle then picked entry_points[0] (or the first entry point that has a waiter), so the query the cycle was anchored at changed from run to run and the reported cycle text was unstable. Single-threaded cycle reporting anchors at the query that was entered first, that is the one defined earliest in the source. The cycle stack records, for each query, the span of its incoming edge: where its predecessor in the cycle requested it. The query the cycle wraps back around to has the latest such span, so pick the entry point with the maximum incoming-edge span to match the single-threaded anchor. Ties prefer an entry point that has an outside waiter so the "cycle used when" note is still produced. This only changes process_cycle, which runs exclusively under the parallel front-end, so single-threaded output is unchanged.
These tests were marked ignore-parallel-frontend because the reported cycle anchor was nondeterministic. Now that process_cycle picks the entry point deterministically their output is stable, so drop the directive. Removing the directive line shifts the following source lines up by one, so the expected stderr is re-blessed to match.
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.
The parallel front-end reports query cycles through the deadlock handler, which collects the active query jobs in a nondeterministic order.
process_cyclethen anchored the reported cycle atentry_points[0](or the first entry point that has a waiter), so the query the cycle text was anchored at changed from run to run, and several UI tests had unstable output under-Zthreads.This makes the entry-point selection deterministic. Single-threaded cycle reporting anchors at the query that was entered first, that is the one defined earliest in the source. The cycle stack records, for each query, the span of its incoming edge: where its predecessor in the cycle requested it. The query the cycle wraps back around to has the latest such span, so the entry point with the maximum incoming-edge span is chosen to match the single-threaded anchor. Ties prefer an entry point that has an outside waiter so the "cycle used when" note is still produced.
process_cycleonly runs under the parallel front-end, so single-threaded output is unchanged.With the anchor stable, six UI tests that were marked
ignore-parallel-frontendfor this reason are re-enabled. Removing the directive line shifts the following source lines up by one, so their expected stderr is re-blessed accordingly.The remaining ignored cycle tests are left as-is: they fail for other reasons (the "cycle used when" note attribution, or selection among multiple simultaneous cycles) that this change does not address.
Validated single-threaded and under
--parallel-frontend-threads=16at high iteration counts (400 to 600 iterations per test with--force-rerun).