incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Schneider <maili...@cedarsoft.com>
Subject Re: Write race conditions, working without _rev
Date Mon, 08 Nov 2010 15:17:32 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For me this looks different:

curl --HEAD http://127.0.0.1:5984/example/post98
HTTP/1.1 200 OK
Server: CouchDB/1.0.1 (Erlang OTP/R13B)
Etag: "1-8908180fecd9b17657889f91973f89eb"
Date: Mon, 08 Nov 2010 15:16:14 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 122
Cache-Control: must-revalidate


So the rev seems to be the Etag...


On 11/07/2010 03:25 AM, couchdb user wrote:
> To follow up on what Chad said about avoiding reading the doc to get
> the _rev, you can also use a HEAD request, while it is an extra
> request, it will use a lot less resources.
> 
> 
> $ curl -HEAD http://127.0.0.1:5984/example/post98
> {"_id":"post98","_rev":"1-9e6543bfb3cbf3b7c36904a1ea4b806f","tags":"[2,5]"}
> 
> Regards,
> 
> 
> On Sat, Nov 6, 2010 at 3:52 PM, Luciano Ramalho <luciano@ramalho.org> wrote:
>> On Fri, Nov 5, 2010 at 2:03 PM, Paul Davis <paul.joseph.davis@gmail.com> wrote:
>>> In the second case, the second person to write the document wins,
>>> erasing any changes the first write's effects. The first writer will
>>> then be in a state where his view of the database will be
>>> inconsistent. The thing his, he can't know because without requiring a
>>> _rev token he'll never get a notification of any sort of error.
>>
>> As I understand, the situation you describe above never happens in
>> practice with CouchDB. A second PUT to the same document _id will
>> always require the _rev attribute, so there's no way to overwrite a
>> previous update by accident. This is one of the best features of
>> CouchDB for document-oriented persistency.
>>
>>
>> --
>> Luciano Ramalho
>> programador repentista || stand-up programmer
>> Twitter: @luciano
>>

- -- 
Johannes Schneider - blog.cedarsoft.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJM2BSJAAoJEAytD9R7Qv6d0nIH/ROBieDaYqnOoniF6ekaZWtt
tM7P/HQsnCssTLpqnB+a57lyeCz02pK6kOmRbNTk9qt6nJSr7KvGQf8ktRljkpZS
uzqTzhaFNvhHLPdEkQn1ZwNMuLlaF9xP7e6teTiPvD+dFPS8oOj4NeaQvb5uyGJl
dMlcQqATdUrTl1MX0KoWLdzEj0uyxXAow9FuXCdHPE7u9LcMvTOcyFdbCa/pTNdI
4qu2Annk88lylihZces+Q4q25DI4hfv1Phncuej605QgaWwY6Uezb5JjDi76jW7B
XfscTq4RKNRxpLuQBYwL7LGJSSQg7ebyQBNquLQcl5niNoqgkt1ldbfZIt7eik4=
=XiX3
-----END PGP SIGNATURE-----

Mime
View raw message