On Fri, Feb 19, 2010 at 02:29:50PM +1100, Mark Hammond wrote:
> I guess is might be possible for a document to be deleted between
> the view row being processed and the doc being opened for the view
> result but I don't think this is happening here - the view also
> emits the document _rev
I didn't think the view Btree index included the _rev. If it did it would
allow really neat things like proper view etags, as well as preventing the
race condition you describe.
However if it did, I would also expect the rev to be in the raw view rows,
i.e.
{"id":"xxx","rev":"yyy","key":"aaa","value":"bbb","doc":{...}}
^^^^^^^^^^^
Do you mean that you have emit(..., {_rev: doc._rev}) in your view? In that
case check the code to see if the _rev is used without an explicit _id. Or
you could try
emit(..., {_id: doc._id, _rev: doc._rev})
to see if that behaves any better.
> I tracked the code returning null to couch_httpd_view:doc_member - it does:
>
> case (catch couch_httpd_db:couch_doc_open(Db, DocId, Rev, [])) of
There is a LOG_DEBUG just above that. What does it show? In particular, is
Rev nil? In that case you'll just get "current" version. Or is it getting
the rev of a deleted doc?
I tried walking the code but got a bit lost. I was trying to check whether
Rev is always nil, or is taken from view row _rev member, or somewhere else.
Regards,
Brian.