Company
Date Published
Author
Rae McKelvey
Word count
1696
Language
English
Hacker News points
None

Summary

Ditto version 4 introduces a significant internal database upgrade with performance and design enhancements, primarily by replacing the current CRDT's RemoveWins merge behavior with an AddWins approach. This change aims to address the limitations of RemoveWins, where a remove operation permanently deletes documents, making it impossible to undo without observing all delete actions. In contrast, AddWins allows for undoing removals by enabling devices to upsert documents again, offering more flexibility and reliability in disconnected environments. While Ditto V4 is incompatible with earlier versions like V2, it can sync with V3, which serves as an intermediary to prepare for the transition. To fully leverage the new AddWins functionality, users must ensure that all devices are updated to V4 and enable the feature flag `disableSyncWithV3()`. This transition requires careful coordination, especially for multi-tenant customers, and Ditto emphasizes the importance of not skipping versions to avoid syncing issues.