0

The local pouchdb database at one of my users has gone out of sync with the Couchdb servers.

  1. Some docs have different revs
  2. Some docs missing in local pouchdb.
  3. Some docs missing in remote couchdb.

I have 2 way live sync with retry turned on.

Why does this happen? Does it make sense to copy the docs (get and put) from local to remote and vice versa?

Thanks for your help.

sureshvv
  • 4,234
  • 1
  • 26
  • 32
  • I am also facing the same issue of missing documents when trying to sync my local data using pouchdb to my remote couchdb server. The data also disappears from the remote couchdb. It looks like a bug in the sync function. – Phantom007 Feb 10 '21 at 03:45

1 Answers1

1

CouchDb uses checkpoints to limit the scope of replications. I have noticed that if you replicate with insufficient access to the remote database then fix the access problem and retry, the documents that were refused the first time are not replicated again. I believe this is a result of checkpoints, though if you use filters they can also cause issues.

There is a previous answer with a bit more information.

So your issue could be due to checkpoints or filters - my best guess is checkpoints from what you have said. It is possible to disable checkpoints although there are some downsides mentioned in the CouchDb documentation which imply replication events would take a bit longer.

IanC
  • 865
  • 8
  • 11
  • This looks like a fix for a couchdb problem rather than for a pouchdb sync. Do they use the same mechanism? – sureshvv Dec 06 '19 at 18:49
  • Yes I am pretty sure they implemented checkpoints in PouchDb itself a while back, according to this pull request: https://github.com/pouchdb/pouchdb/pull/4035 So it may be possible to use an option in PouchDb (see this pull request https://github.com/pouchdb/pouchdb/issues/6308) rather than disable checkpoints in CouchDb. – IanC Dec 06 '19 at 20:32
  • This sounds like a bug in the checkpoint algorithm. If a document is not replicated but another created afterwards is, that does not absolve the 1st one. Should we file a bug report? – sureshvv Dec 07 '19 at 10:39