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

Improve DataConflictException handling in case of partial local modification #409

Merged

Conversation

pfleeter
Copy link

In the case where only some of the records in a patch are skipped by ConditionallyPutRecords, maxPatchSyncCount will not cause the dataset sync count to be reset sufficiently to correct the skipped records when they experience a DataConflictException on future sync attempts. (Especially likely if multiple records are always updated together.)

Another possibility for this might be to have ConditionallyPutRecords return a flag for whether it skipped any records, and if it did, to not update the dataset sync count in the DataConflictException handler.

Attempts to address issue #391

Paul Fleetwood added 2 commits June 28, 2016 11:25
…t, the maxPatchSyncCount will not reset the dataset sync count sufficiently.
… by the same device during sync.

When a record is updated during the sync operation, it's meta data will not be updated, even though the prior local modification was written to the server, and the sync count was updated.  During the next sync operation, the put to remote will fail, due to a data conflict exception (modifying a stale sync count).  The data conflict exception handling will then fall back to an older sync count for the dataset and try again.  This will lead to a case where the local change (with an older sync count) conflicts with a remote change (older, but with a more recent sync count).

To avoid this conflict, update the local records meta data during the first push.  This means that on a subsequent push, there will not be a data conflict exception, and ultimately there will not be a conflict-with-self where the sync counts reflect the opposite of what is actually true in terms of data recency.

The goal is to make it look like the put operation succeeded, wrote the remote record to local storage, and *then* performed the update (instead of performing the update before the put send/receive had a chance to finish).
@stevejroberts stevejroberts merged commit b6d4162 into aws:master Aug 15, 2016
@stevejroberts
Copy link
Contributor

PR merged, thanks for the contribution.

@pfleeter pfleeter deleted the fix-data-conflict-with-min-patch-sync-count branch January 20, 2017 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants