drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

The method for removing events that precede the baseline is not correct #103

Closed drewmccormack closed 10 years ago

drewmccormack commented 10 years ago

The deleteEventsPreceedingBaselineWithCompletion: method in CDERebaser is not correct. It simply takes all events with a global count older than the baseline. But the global count of the baseline can recede when new devices join, so this will not always catch all the events that need removal.

Instead, it will be necessary to go through events for a single device in the baseline, and remove the ones with a revision number older than the baseline has for that device. Repeat for all devices.

drewmccormack commented 10 years ago

Fixed by adding a more sophisticated method, but need unit tests for cases like this:

Baseline has global count less than all other events. Baseline has revisions which are greater than some events.