Couchbase Lite replication checkpoint appears to be resetting back to 0 and doing a full check ,despite being up to date previously

A few of our iOS devices seem to have started doing a full replication of all the data. Using Couchbase Lite 2.8.2 and Sync Gateway 2.8.2. Couchbase Server 6.5.0 all CE
In the Sync Gateway logs I can see that the sequence number for one of the devices was 4824929 yet the total number of sequences was 155680515.

This device is turned on every day and was up to date, so I would have expected it to be higher (there weren’t 100000000 changes in a day).

The only thing that I can think of that has caused this, is that we started up some new devices that had no data on, so these are doing a full sync. Is there a reason why if new devices start syncing, it would cause every other device to do a full sync, despite already being roughly up to date?

Another thing to note is that the replication.status.progress.completed/replication.status.progress.total numbers don’t change whilst it is going over the changes the device already has and the addDocumentReplicationListener doesn’t pass any documents, which makes sense I guess.

Might be related to other issues I have raised
https://www.couchbase.com/forums/t/indexes-suddenly-getting-hundred-of-thousands-of-mutations-and-increasing/31512/7
https://www.couchbase.com/forums/t/sync-gateway-only-seems-to-be-sending-data-to-3-devices-at-a-time/29465/3

If either side disagrees about where the replication left off there is no choice but to restart from the beginning. However it’s not quite as bad as you might think. The protocol will work out what revisions it needs before actually asking for them so what actually happens is a sequence of “do you have this?” “yes” “do you have this?” “yes” which is much faster than sending the entire bodies but still wasteful. One common scenario that causes this is seeding a database to devices without using the Database.copy API. This causes different databases to share the same checkpoint ID and effectively stomp on each other so that disagreements happen more often. But other than that this would need to be root caused by analyzing what is happening in the environment.