fix: dead loop when importing updates #570
Merged
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.
Fix the dead loop issue here: https://gist.github.com/sunflowerdeath/c0e2b46b6f5d2e32d368f8e04f730237
Reason for the Dead Loop in
find_common_ancestorOriginal Assumptions
Dependency Assumption
If a DagNode is depended upon by other nodes, the direction of this dependency will only point to before the end of the node. This assumption is used in system design.
Node Overlap Assumption
DagNodes do not overlap with each other. When retrieving DagNodes from two different positions:
Current Issues
Issues Caused by Lazy Loading
Due to the use of lazy loading, new situations have arisen. Initially:
Impact of Subsequent Loading
After loading additional DagNodes:
Violation of Original Assumptions
In this case, when retrieving the content of the original DagNode again:
Fix Approach
Remove the assumption in the original implementation that "overlapping DagNodes will not occur." When overlapping DagNodes are found, retain the shorter one and remove the longer one.