-
Notifications
You must be signed in to change notification settings - Fork 297
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 Push (to CouchDB) is failing when attachments are involved #817
Comments
Oh, looks like I still have the Objective-C version of the test I used lying around: https://gist.github.com/borrrden/c581d3ee45c75ffcfe8f |
CBL java had issue of push replication with attachment. This issue was fixed by community developer. This might help CBL iOS. https://github.com/couchbase/couchbase-lite-java-core/issues/600 |
I could reproduce the issue with @borrrden's unit test. I simplified the unit test by only creating one document. I ran the unit test on both CouchDb and Sync-Gateway. CouchDB returned an error as it couldn't find the (stub) attachment as the specified revpos. Sync-Gateway on the other hand didn't report the error.
Error appeared on the client log:
|
During the pull replication, the revpos of an attachment could be set to a parent revision while the follows=true. If the revpos value doesn't get preserved, the revpos will be set to the current generation. Later, when pushing an updated document again, the attachment info will contain a wrong revpos and result to the missing_stub error on CouchDB. SyncGateway currently ignores the issue and doesn't overwrite the revpos value on the server side. #817
@zgramana I have seen the same issue was in 1.1.1 for .NET so I will move the fix to 1.1.1 iOS as well. |
During the pull replication, the revpos of an attachment could be set to a parent revision while the follows=true. If the revpos value doesn't get preserved, the revpos will be set to the current generation. Later, when pushing an updated document again, the attachment info will contain a wrong revpos and result to the missing_stub error on CouchDB. SyncGateway currently ignores the issue and doesn't overwrite the revpos value on the server side. #817
couchbase/couchbase-lite-net#449
There was some stuff in here that was incorrect on .NET but not on iOS that can be ignored but the crux of the problem is that CouchDB potentially sends the revpos of an attachment in a "follows" style response, but Couchbase Lite only checks for revpos in a "stub" style response.
Unit Test: https://github.com/couchbase/couchbase-lite-net/blob/master/src/Couchbase.Lite.Tests.Shared/ReplicationTest.cs#L409-L493
Solution is to add the following lines: https://github.com/couchbase/couchbase-lite-net/blob/master/src/Couchbase.Lite.Shared/Documents/AttachmentInternal.cs#L238-L245
The text was updated successfully, but these errors were encountered: