loro/crates/examples/examples
Zixuan Chen 0325061476
fix: dead loop when importing updates (#570)
Fix the dead loop issue here: https://gist.github.com/sunflowerdeath/c0e2b46b6f5d2e32d368f8e04f730237

# Reason for the Dead Loop in `find_common_ancestor`

### Original Assumptions

1. **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.

2. **Node Overlap Assumption**

   DagNodes do not overlap with each other. When retrieving DagNodes from two different positions:
   - They are either completely identical
   - Or they do not overlap at all
   - If there is overlap, it means they are the same node

### Current Issues

1. **Issues Caused by Lazy Loading**

   Due to the use of lazy loading, new situations have arisen. Initially:
   - A certain DagNode is not depended upon by other DagNodes
   - Therefore, the initially retrieved form is complete

2. **Impact of Subsequent Loading**

   After loading additional DagNodes:
   - The newly loaded DagNode may depend on the internal position of the previously complete DagNode
   - This causes the originally complete DagNode to be split into multiple smaller DagNodes

3. **Violation of Original Assumptions**

   In this case, when retrieving the content of the original DagNode again:
   - Other DagNode dependencies may appear in the middle
   - There may be overlaps on the DagNode
   - This violates the original design assumptions

# 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.
2024-11-29 13:01:15 +08:00
..
concurrent_set_map.rs perf: use better data structure for frontiers (#515) 2024-10-16 16:22:36 +08:00
draw.rs Fix warnings (#484) 2024-09-29 21:15:19 +08:00
flat_folder.rs Refactor rename trimmed snapshot to shallow snapshot (#499) 2024-10-08 13:15:14 +08:00
flat_folder_by_map.rs Refactor rename trimmed snapshot to shallow snapshot (#499) 2024-10-08 13:15:14 +08:00
fork.rs perf: optimize kv export_all by reusing encoded block (#501) 2024-10-09 10:22:17 +08:00
init_sheet.rs refactor: Loro import function should return LoroEncodeError (#487) 2024-10-02 11:11:08 +08:00
issue_stuck.rs fix: dead loop when importing updates (#570) 2024-11-29 13:01:15 +08:00
large_map.rs fix: fractional index is enabled by default now (#561) 2024-11-18 14:32:56 +08:00
large_movable_list.rs refactor: Loro import function should return LoroEncodeError (#487) 2024-10-02 11:11:08 +08:00
list.rs refactor: Loro import function should return LoroEncodeError (#487) 2024-10-02 11:11:08 +08:00
outliner.rs refactor: Loro import function should return LoroEncodeError (#487) 2024-10-02 11:11:08 +08:00
sheet.rs perf: use simplified internal string (#551) 2024-11-11 15:08:27 +08:00
text.rs fix: add text example for bench & fix a few related bugs 2024-08-17 22:00:39 +08:00
time_tracker.rs Refactor rename trimmed snapshot to shallow snapshot (#499) 2024-10-08 13:15:14 +08:00