You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Mikhail Sobolev <mi...@gmail.com> on 2010/04/05 22:58:27 UTC
couchdb.http.PreconditionFailed: ('missing_stub', ...)
Hi,
I just upgraded to couchdb 0.11 and my application fails with
couchdb.http.PreconditionFailed: ('missing_stub', ...)
What could lead to such an error?
--
Misha
Re: couchdb.http.PreconditionFailed: ('missing_stub', ...)
Posted by Mikhail Sobolev <mi...@gmail.com>.
Hi,
(Sorry to follow up myself)
On Tue, Apr 6, 2010 at 9:41 PM, Mikhail Sobolev
<mi...@gmail.com> wrote:
>>> My bet is on you try updating or deleting a document without passing in a valid _rev.
>> The code used to work.
> The funny thing is that the code that throws the exception
> (src/couchdb/couch_doc.erl:364) was written in November last year...
OK, I played a bit with the code I sent previous (fap.py) and it
turned out that the following change is done:
- doc['_attachments'][filename] = dict(stub=True, revpos=doc.rev)
+ doc['_attachments'][filename] = dict(stub=True,
revpos=int(doc.rev.split('-')[0]))
everything starts to work as it used to without revpos.
--
Misha
PS The main reason why I did the code like this is because I did not
want to download the whole document every time any of its attachments
are downloaded.
Re: couchdb.http.PreconditionFailed: ('missing_stub', ...)
Posted by Mikhail Sobolev <mi...@gmail.com>.
>> My bet is on you try updating or deleting a document without passing in a valid _rev.
> The code used to work.
The funny thing is that the code that throws the exception
(src/couchdb/couch_doc.erl:364) was written in November last year...
--
Misha
Re: couchdb.http.PreconditionFailed: ('missing_stub', ...)
Posted by Mikhail Sobolev <mi...@gmail.com>.
Hi Jan,
On Tue, Apr 6, 2010 at 5:21 PM, Jan Lehnardt <ja...@apache.org> wrote:
> On 5 Apr 2010, at 22:58, Mikhail Sobolev wrote:
>> I just upgraded to couchdb 0.11 and my application fails with
>> couchdb.http.PreconditionFailed: ('missing_stub', ...)
>>
>> What could lead to such an error?
>
> Some code :D — What are you trying to do? :)
This idea crossed my mind :)
Essentially, I'm doing the following:
1. create a document with props
2. save it
3. add an attanchment
4. update some document props related to the attachment
5. save the updated document
3-5 are repeated several times.
At 3 & 5, the _rev is updated properly. At 3 with the previous
version of couchdb (0.10.1) a simple 'trick" of adding/updating
_attachment ("filename": { "stub": true}) was working just fine. With
the new version it bails out with the message in the subject. The
attached file shows what I'm I doing the 'head' of couchdb-python
module. (The previous version did not have 'revpos=doc.rev'.)
> My bet is on you try updating or deleting a document without passing in a valid _rev.
The code used to work.
--
Misha
Re: couchdb.http.PreconditionFailed: ('missing_stub', ...)
Posted by Jan Lehnardt <ja...@apache.org>.
On 5 Apr 2010, at 22:58, Mikhail Sobolev wrote:
> Hi,
>
> I just upgraded to couchdb 0.11 and my application fails with
> couchdb.http.PreconditionFailed: ('missing_stub', ...)
>
> What could lead to such an error?
Some code :D — What are you trying to do? :)
—
My bet is on you try updating or deleting a document without passing in a valid _rev.
Cheers
Jan
--