yorkie-team / yorkie

Yorkie is a document store for collaborative applications.
https://yorkie.dev
Apache License 2.0
761 stars 140 forks source link

Fix inconsistent garbage collection for multiple nodes in text and tree type #855

Closed chacha912 closed 3 months ago

chacha912 commented 3 months ago

What this PR does / why we need it:

There was an issue in the garbage collection process when dealing with multiple nodes in text(tree) types. When some nodes in text were collected, the corresponding text was removed from elementHasRemovedNodesSetByCreatedAt in the root, preventing the GC from correctly processing the remaining nodes.

This PR addresses the inconsistency in the GC process by modifying the condition under which text is removed from elementHasRemovedNodesSetByCreatedAt. Instead of removing text when some nodes are garbage collected, text will now only be removed when all nodes have been garbage collected. This change ensures that GC behaves consistently even when multiple nodes are involved.

Which issue(s) this PR fixes:

Related https://github.com/yorkie-team/yorkie-js-sdk/pull/806

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Additional documentation:

Checklist:

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 50.81%. Comparing base (5a77d08) to head (bb2d517).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #855 +/- ## ======================================= Coverage 50.81% 50.81% ======================================= Files 70 70 Lines 10285 10285 ======================================= Hits 5226 5226 Misses 4530 4530 Partials 529 529 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.