I haven’t been inside the 1.x codebase in aeons, but IIRC ‘parentAttachment’ is 
the attachment Dict in the parent revision of the document. I’m not sure why 
it’s required to exist at that point; sorry...

—Jens

On Sep 12, 2018, at 8:46 PM, Brendan Duddridge 
<[email protected]<mailto:[email protected]>> wrote:

Hi,

I think this post got lost in the shuffle a long time ago. But I'm seeing this 
error today and I'm trying to resolve the conflict.

How do I deal with the parentAttachment issue?

What exactly is the parentAttachment? Maybe if I knew that I could figure out a 
way to solve the problem.

Thanks,

Brendan

On Saturday, March 24, 2018 at 7:47:49 PM UTC-6, Brendan Duddridge wrote:
Hi,

I'm trying to resolve a conflict in my database and during processing of the 
conflicts, I try to save the new revision and I get the following error:


19:33:51.584| Database: PUT _id=rec-34444c73468b47e78a82b574c9e1d44f, 
_rev=38-910e724b542aaa5c6b224bf992e6de09 (allowConflict=1)

19:33:51.584| WARNING: Don't have original attachment for stub 
'343EBC56-262B-4A23-B2C9-8EA57F5EAC7A~L0~001.jpeg' in 
{rec-34444c73468b47e78a82b574c9e1d44f #39-00} (missing attachment) {at 
-[CBLDatabase(Attachments) 
processAttachmentsForRevision:ancestry:allowStubAttachments:status:]_block_invoke:424}

2018-03-24 19:33:51.584415-0600 Tap Forms 5[28952:19787125] Error saving 
conflicted document: Error Domain=CBLHTTP Code=400 "Invalid attachment" 
UserInfo={NSLocalizedFailureReason=Invalid attachment, 
NSLocalizedDescription=Invalid attachment}

The attachment being saved looks like this:


    "343EBC56-262B-4A23-B2C9-8EA57F5EAC7A~L0~001.jpeg" =     {

        "content_type" = "image/jpeg";

        digest = "sha1-NV3+66TwIEkBkPXfkTHNsWbWeOs=";

        length = 290839;

        revpos = 6;

        stub = 1;

    };


I checked the attachments folder and the image with the blobKey definitely 
exists.

According to the source code in CBLDatabase+Attachments.m (424), it's failing 
because of this block of code:


NSDictionary* parentAttachment = parentAttachments[name];

if (!parentAttachment) {

    Warn(@"Don't have original attachment for stub '%@' in %@ (missing 
attachment)",

         name, rev);

    *outStatus = kCBLStatusBadAttachment;

    return nil;

}

return parentAttachment;

So it would seem that I don't have a parent attachment.

Is there a way I can manipulate the attachment somehow in order to resolve the 
conflict?

This is the conflict that's being processed:


2018-03-24 19:33:51.460514-0600 Tap Forms 5[28952:19787125] conflicted doc id: 
rec-34444c73468b47e78a82b574c9e1d44f

2018-03-24 19:33:51.460766-0600 Tap Forms 5[28952:19787125] conflicts: (

    "CBLSavedRevision[rec-..d44f/38-910e724b542aaa5c6b224bf992e6de09]",

    "CBLSavedRevision[rec-..d44f/6-9f986ed79a5f45a296b807b709c72c31]"

)


So there's quite a big difference between 6 and 38 for the revision numbers. 
Maybe that has something to do with it?

CBL 1.4.1 on macOS High Sierra btw.

Thanks,

Brendan





--
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/90961185-e620-4e44-8c58-635a375bf896%40googlegroups.com<https://groups.google.com/d/msgid/mobile-couchbase/90961185-e620-4e44-8c58-635a375bf896%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
Privacy Policy<https://www.couchbase.com/privacy-policy> | Update Marketing 
Preferences<https://info.couchbase.com/unsubscribe-or-manage-preferences>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/C0C9A0D0-8991-40AE-994F-9B266B0C7670%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to