-
Notifications
You must be signed in to change notification settings - Fork 298
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
Replication rejects attachments generated by PouchDB with revpos:0 #1200
Comments
I can confirm that the abovementioned doc has been successfully replicated using CouchDB 1.6.1 replicator. |
Some additional info The warning is triggered here: https://github.com/couchbase/couchbase-lite-ios/blob/master/Source/CBLRestPuller.m#L711-L714 We don't know how the doc with the bogus revpos has been created yet. |
Why is |
Add the `revpos` property to the attachment stub. The `revpos` is the doc's `rev` prefix (a sequential number) from when the attachment was added or updated. It is used during replication in the CouchDB replicator (and others including CouchBase Lite) to avoid copying attachments that have not changed since the last replication. This solves a problem with documents with attachments created in PouchDB, which are later replicated to an Apache CouchDB. If the doc is then pulled from an iOS application using CouchBase Lite the doc is skipped, because CBL rejects the attachments because of invalid attachment stub (see couchbase/couchbase-lite-ios#1200) Also this improves replication performance of documents created by PouchDB, which were later synced using Apache CouchDB replicator.
Add the `revpos` property to the attachment stub. The `revpos` is the doc's `rev` prefix (a sequential number) from when the attachment was added or updated. It is used during replication in the CouchDB replicator (and others including CouchBase Lite) to avoid copying attachments that have not changed since the last replication. This solves a problem with documents with attachments created in PouchDB, which are later replicated to an Apache CouchDB. If the doc is then pulled from an iOS application using CouchBase Lite the doc is skipped, because CBL rejects the attachments because of invalid attachment stub (see couchbase/couchbase-lite-ios#1200) Also this improves replication performance of documents created by PouchDB, which were later synced using Apache CouchDB replicator.
(I believe the sanity check will accept an attachment with no |
While I totally agree that revpos 0 does not make any sense at all this behaviour breaks replication with a CouchDB, which has docs with attachments generated by PouchDB. |
We can figure out a workaround — treating But I'm curious why this is only happening now, when Couchbase Lite has been interoperating with CouchDB since 2011. It sounds like it's PouchDB that generates the revisions with |
Hi @snej, thanks for the discussion! Yes, the In pouchdb/pouchdb#3930 there is also a discussion about this topic btw. But even if PouchDB will support |
Add the `revpos` property to attachment stubs on save. `revpos` is the doc's `rev` prefix (a sequential number) from when the attachment was added or updated. It is used during replication in the CouchDB replicator (and others including CouchBase Lite) to avoid fetching attachments that have not changed since last replication. This solves a problem with attachments created in PouchDB, which are then replicated to an Apache CouchDB instance. They end up having a `revpos` property set to `0`. When the doc is later pull replicated from an iOS application using CouchBase Lite it is skipped and does not get replicated. This is because CBL rejects attachments with invalid attachment stub (see couchbase/couchbase-lite-ios#1200). `revpos:0` is considered invalid in CBL. Also this improves replication performance of documents with attachments created by PouchDB, when they are later replicated using Apache CouchDBs own replicator. The Apache CouchDB replicator itself handles `revpos:0` docs without a problem. But the replication of those docs cannot be optimized; the attachments get copied over again for every revision, even if they did not change.
Add the `revpos` property to attachment stubs on save. `revpos` is the doc's `rev` prefix (a sequential number) from when the attachment was added or updated. It is used during replication in the CouchDB replicator (and others including CouchBase Lite) to avoid fetching attachments that have not changed since last replication. This solves a problem with attachments created in PouchDB, which are then replicated to an Apache CouchDB instance. They end up having a `revpos` property set to `0`. When the doc is later pull replicated from an iOS application using CouchBase Lite it is skipped and does not get replicated. This is because CBL rejects attachments with invalid attachment stub (see couchbase/couchbase-lite-ios#1200). `revpos:0` is considered invalid in CBL. Also this improves replication performance of documents with attachments created by PouchDB, when they are later replicated using Apache CouchDBs own replicator. The Apache CouchDB replicator itself handles `revpos:0` docs without a problem. But the replication of those docs cannot be optimized; the attachments get copied over again for every revision, even if they did not change.
Add the `revpos` property to attachment stubs on save. `revpos` is the doc's `rev` prefix (a sequential number) from when the attachment was added or updated. It is used during replication in the CouchDB replicator (and others including CouchBase Lite) to avoid fetching attachments that have not changed since last replication. This solves a problem with attachments created in PouchDB, which are then replicated to an Apache CouchDB instance. They end up having a `revpos` property set to `0`. When the doc is later pull replicated from an iOS application using CouchBase Lite it is skipped and does not get replicated. This is because CBL rejects attachments with invalid attachment stub (see couchbase/couchbase-lite-ios#1200). `revpos:0` is considered invalid in CBL. Also this improves replication performance of documents with attachments created by PouchDB, when they are later replicated using Apache CouchDBs own replicator. The Apache CouchDB replicator itself handles `revpos:0` docs without a problem. But the replication of those docs cannot be optimized; the attachments get copied over again for every revision, even if they did not change.
Thanks a lot! |
The issue seems to be revpos not having a proper value, value is 0 and should be 2 in this case.
But anyway i would expect this doc to be synced.
The text was updated successfully, but these errors were encountered: