-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in treePath for Remote Changes in tree.edit
operation for concurrent edit
#773
Comments
I tried reproducing the above situation using But interestingly, when we recreated a similar situation in yorkie-js-sdk/src/document/crdt/rga_tree_split.ts Lines 935 to 971 in 653f98e
Based on this result, in the case of trees as well, I think that when deletion of consecutive sections occurs, it may be possible to solve the problem by delivering change events in reverse order rather than adjusting the index from the previous event. |
We can think about the below solutions for this issue:
Regarding solution A, since Text is linear in structure and Tree is hierarchical, we need to consider side-effect of reversing. |
Although Tree is hierarchical, it can be applied like a linear data structure by mapping it into a 'token list' and performing operations based on it. As mentioned in the comment above, changes to textNode do not require index adjustment when the order is reversed, so it does not seem to be a problem to resolve the issue by reversing the order when creating changes for range deletion in the tree. yorkie-js-sdk/src/document/crdt/tree.ts Lines 1388 to 1449 in dc9146f
|
This commit addresses the issue where, in a tree data structure, when deletion operations occur and are split into multiple events by makeDeletionChanges, the order of events needs to be reversed. If you don't reverse the order, you may lead to situations where adjustments to the range are necessary for subscribers of the events. More detailed information on this scenario can be found in issue #773. When deletion operations result in multiple events due to the makeDeletionChanges() function, in order to prevent issues for subscribers handling these events, the order of events must be reversed. By reversing the order of events, there is no need to adjust the range of the next event by the previous event.
What happened:
In the scenario of concurrent editing in
tree.edit
, there is an issue where thefromPath
andtoPath
for remote change events related to section deletion are not returning correctly.To illustrate further, let's consider the following situation:
Client 1 deletes the block "12345" and adds 'z'
Client 2 adds 'x' between '3' and '4'
The remote change received by client 2 is as follows:
However, due to the result of the first remote change, the offset of the second remote change should be adjusted to [0,0,0,2] & [0,0,0,4].
You can reproduce the issue using the test code below:
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
yorkie version
):The text was updated successfully, but these errors were encountered: