Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3958: ReplaceSubgraph interaction with replace_references r=jhelwig a=jhelwig # Commits ## Log how many pre-existing edges there are, and how many removals/additions were requested when an ExclusiveEdgeMismatch conflict is detected ## Make Update::ReplaceSubgraph only import a single node, instead of the entire subgraph The problem with importing the entire subgraph is that we also still generate `Update` entries for things below the root of the `Update::ReplaceSubgraph`, and that `find_in_self_or_create_using_onto` + `replace_references` ends up with the uinion of the "child" nodes from both `self` and `onto` as the child nodes in the resulting graph. What we want is either only the child nodes from `onto` with no further `Update` entries for things below the root of the `Update::ReplaceSubgraph`, or for only the specific node referenced in `Update::ReplaceSubgraph` to be replaced, to maintain the pre-existing child nodes in `self`, and to let the `Update` entries for things below the root specified in `Update::ReplaceSubgraph` to handle the rest of the subgraph update/import. ## Do not modify the subgraph of the target of an Update::NewEdge when the edge target already exists The scenario: * `detect_confilcts_and_updates` walks the `onto` graph as its basis for detecting things. * If we don't find any candidates for equivalency for a particular node in `onto` from the nodes in `to_rebase`, then we do nothing, and prune the walk of the `onto` graph at that point. * When processing a container in `find_container_membership_conflicts_and_updates` (processing a/the parent of the potentially new node). * There is an entry in `only_onto_edges` for the edge pointing to a node. (May or may not be to a new node) * We generate an `Update::NewEdge` * If the node exists already in `to_rebase` (not new) * When processing the DFS event for the node, we continue walking the `onto` graph through this node as long as we continue to find equivalent nodes in `to_rebase`, generating `Update`s as necessary. * If the node does _not_ already exist in `to_rebase` (it's new) * When processing the DFS event for the node, we prune the `onto` graph walk as we could not find an equivalent node, and do not generate any `Update` for the node that only exists in `onto`. So, when `Update::NewEdge` happens in `perform_updates`, if an equivalent node is found, we want to use it as-is, since there should be other `Update` to process that will handle any updates necessary for the target (and any children). If no equivalent node is found, then we want to import the "new" bits from the subgraph starting at the target of the edge, since there won't be any `Update` to process that will handle bringing in those new things. Co-authored-by: Jacob Helwig <[email protected]>
- Loading branch information