fix(federation): fixed a QP panic saying "would create a cycle"#5797
Merged
goto-bus-stop merged 3 commits intodevfrom Aug 12, 2024
Merged
fix(federation): fixed a QP panic saying "would create a cycle"#5797goto-bus-stop merged 3 commits intodevfrom
goto-bus-stop merged 3 commits intodevfrom
Conversation
Contributor
|
@duckki, please consider creating a changeset entry in |
|
CI performance tests
|
lrlna
reviewed
Aug 12, 2024
Comment on lines
-1454
to
+1456
| for node_index in self.graph.node_indices() { | ||
| let sorted_nodes = petgraph::algo::toposort(&self.graph, None) | ||
| .map_err(|_| FederationError::internal("Failed to sort nodes due to cycle(s)"))?; | ||
| for node_index in sorted_nodes { |
Member
There was a problem hiding this comment.
non-blocking comment: what's the performance cost of doing a topological sort here, do you know?
Member
There was a problem hiding this comment.
I tried a few queries with known-big fetch dependency graphs, and this function doesn't really show up in a flame graph. I think because it only happens once, as the absolute last step, when the graph has already been reduced as much as it can.
Contributor
Author
There was a problem hiding this comment.
Thanks for that analysis. I didn't observe any noticeable slowdown during corpus comparison runs, either.
lrlna
approved these changes
Aug 12, 2024
duckki
added a commit
that referenced
this pull request
Aug 13, 2024
6 tasks
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
merge_fetches_to_same_subgraph_and_same_inputsfunction must merge decendant nodes into ancestor nodes and not the other way around (to avoid cycles).This PR fixes it by topologically sorting the fetch dependency graph nodes before collecting nodes to merge. So, their merger is always topologically ordered.
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.