How can I skip tombstones with the new first-time sync optimized backfill mode?

mobile
.net

#1

I’m trying to take advantage of the new optimized first time sync in CBL .Net that was introduced as part of this issue: https://github.com/couchbase/couchbase-lite-net/issues/552. If I start a pull replication with the Continuous property set to false, then I only get the active documents (as expected). However, when I then startup a pull replication with the Continuous property set to true, I wind up pulling down all of the deletions. I was expecting that the continuous replication would not go back and pull the deletions which the one-shot pull skipped. Is that a wrong assumption? Is there something different I need to be doing?

In our application, if the user has accumulated a lot of deletions, then upon initial sync they may have to wait several minutes for them to all be processed before new items are received. When starting with an empty database, we don’t want to sync these deletions since they aren’t necessary.


#2

I think I figured out the answer. We are still using the 1.2.0.3 release, which does not have the fix for restarting the replicator in commit 2a51e0f15562419b1b190621c5fdb751084b332d. Once you have that, the steps are:

  1. Start with a pull replication where Continuous is set to false
  2. Wait for it to transition to having a status of ReplicationStatus.Stopped
  3. Set Continuous to true on that same replication instance
  4. Call Restart() on the replication

#3

Actually this is normal. The local database must be empty to take advantage of the optimized mode, otherwise there is a possibility of the data becoming mismatched with the server (particularly with conflicts).