-
Notifications
You must be signed in to change notification settings - Fork 129
Description
There is an intermittent problem with saving the last sequence (checkpoint document) after going offline and back online with non-continuous replication.
Library Version
1.4.1
.NET Runtime
.Net 4.6.2
Operating System / Device Details
Windows 10
Log Output
2018-06-18 17:09:27,587 INFO [TabletPCR.exe] [9144] [SYNC (Replication)] Puller aea6bc7c-aae5-4eb2-ba04-207e73fe8e07 checkpointing sequence=
2018-06-18 17:09:27,634 DEBUG [TabletPCR.exe] [9144] [SYNC (RemoteSession)] aea6bc7c-aae5-4eb2-ba04-207e73fe8e07 - Sending PUT request to: https://www.github.com:4984/zd01/_local/61dfc00635926c0b0f30e8962d2e9d7ea145d320
2018-06-18 17:09:27,649 INFO [TabletPCR.exe] [9144] [SYNC (RemoteSession)] Client is disposed, aborting request to https://www.github.com:4984/zd01/_local/61dfc00635926c0b0f30e8962d2e9d7ea145d320
Expected behavior
After going offline and back online, the replicator should get any changes and update the checkpoint document with the latest sequence.
Actual behavior
The checkpoint document for the replicator is never updated, so it keeps processing the same set of changes every time it is started.
Looking at the source for Replication.SaveLastSequence it relies on the completion block passed into RemoteSesssion.SendAsyncRequest to set _savingCheckpoint = false at Replication.cs line 1633.
Unfortunately, the error logged from SendAsyncRequest returns null without calling the completionHandler. This means the _savingCheckpoint variable is never set to false, and it will never save another checkpoint for the life of the replicator because of the check at Replication.cs line 1605 to delay saving the checkpoint if _savingCheckpoint is true.
Steps To Reproduce
- Run a replication on a timer
- Go offline and wait for a period of time
- Go back online
- Sometimes the checkpoint document will be correctly updated with the new lastSequence, and sometimes it will not be updated.
- When it is not updated, the replicator keeps processing the same changes every time it's started.
Reproduction Project
No sample project, but I've attached the CBLite.log and a Fiddler session