Skip to content
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

Data Loss Scenario with DiffMatchPatch #201

Open
roundhill opened this issue Sep 26, 2018 · 0 comments
Open

Data Loss Scenario with DiffMatchPatch #201

roundhill opened this issue Sep 26, 2018 · 0 comments
Labels

Comments

@roundhill
Copy link
Contributor

If you follow the reproduction steps at Automattic/simplenote-android#560 (comment) in Simplenote, you'll get data loss for the last line that you added.

I think this is an issue with the way we are transforming a diff to apply local and remote changes at once to an object here: https://github.com/Simperium/simperium-android/blob/develop/Simperium/src/main/java/com/simperium/client/Bucket.java#L966

I tried a test where I added the text One and Two while offline around a paragraph that was deleted remotely. The incoming patch was:

{"content":{"o":"d","v":"=683\t-815\t+DELETED!"},"modificationDate":{"o":"r","v":1.537995756631E9}}

The local patch was:

{"content":{"o":"d","v":"=685\t+e%0A%0AOn\t=813\t+%0A%0ATwo"},"modificationDate":{"o":"r","v":1537995767}}

But the resulting transformed diff was:

{"modificationDate":{"o":"r","v":1537995767}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant