couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Cohnen <sebastiancoh...@googlemail.com>
Subject Re: Revsion Explained
Date Sun, 12 Sep 2010 13:14:05 GMT
Hi Ido,

consider the _rev token as an opaque value necessary for the mvcc (I'd call it mvcc-token,
since "revision" is often misunderstood). The hash algorithm may even change someday. AFAIK
it contains the document itself and also its history (at least parts of it). The algorithm
ensures that the same document with the same history result in the same _rev token even on
two different nodes. This behavior is required for conflict detection/resolution.

Best

Sebastian


On 12.09.2010, at 14:43, Ido Ran wrote:

> Hi,
> I've read that the _rev fiel in each document is composed of two parts -
> integer which increment by 1 on each change and MD5 hash of the JSON of the
> document.
> What part of the JSON is included in that hash?
> 
> I've created a new document with _id of "foo" and single field name "start"
> with value "99". I've save the document and it got _rev of
> "1-b563730fcffb6583ff48980c1533e439".
> I didn't change anything, just hit save again in Futon and not the _rev is
> "2-75a41bb3bc74cb4d768466efa2a0c1ca".
> If I hit save again I get another hash.
> 
> Why is that?
> 
> Thank you,
> Ido


Mime
View raw message