yorkie-team/yorkie

Consider elements in the undo/redo stack during garbage collection

chacha912 opened this issue · 0 comments

Description:

The current garbage collection behavior involves deleting elements that document replicas can no longer reference. If an element has been deleted and it occurred before minSyncedTicket, it is considered not referable by each replica. However, with the introduction of Undo/Redo, even deleted elements can still be referenced through the undo/redo stack. Consequently, they should not be garbage collected. If garbage collection occurs on elements that are still referenced in the undo/redo stack, it may lead to issues where these elements cannot be found. (Refer to the test code: Should handle the case of reverse operations referencing already garbage-collected elements) Therefore, during garbage collection, it is necessary to check elements referenced by operations in the undo/redo stack.

image
Ensure that elements referenced by operations in the undo/redo stack are not prematurely deleted during garbage collection.

Why:
The reason for this change is that even though elements may have been deleted, they can be referenced again through the undo/redo stack. As a result, an additional condition needs to be added to the garbage collection process to account for elements referenced in the undo/redo stack.