Return-Path: Delivered-To: apmail-incubator-couchdb-dev-archive@locus.apache.org Received: (qmail 88957 invoked from network); 23 Jul 2008 20:59:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Jul 2008 20:59:09 -0000 Received: (qmail 21069 invoked by uid 500); 23 Jul 2008 20:59:09 -0000 Delivered-To: apmail-incubator-couchdb-dev-archive@incubator.apache.org Received: (qmail 21034 invoked by uid 500); 23 Jul 2008 20:59:09 -0000 Mailing-List: contact couchdb-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-dev@incubator.apache.org Received: (qmail 21023 invoked by uid 99); 23 Jul 2008 20:59:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jul 2008 13:59:09 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.68.5.9] (HELO relay00.pair.com) (209.68.5.9) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 23 Jul 2008 20:58:15 +0000 Received: (qmail 95404 invoked from network); 23 Jul 2008 20:57:39 -0000 Received: from unknown (HELO ?192.168.1.199?) (unknown) by unknown with SMTP; 23 Jul 2008 20:57:39 -0000 X-pair-Authenticated: 96.33.90.152 Message-Id: From: Damien Katz To: couchdb-dev@incubator.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v926) Subject: Re: Need help debugging mochiweb/Safari HTTP problems Date: Wed, 23 Jul 2008 16:57:38 -0400 References: X-Mailer: Apple Mail (2.926) X-Virus-Checked: Checked by ClamAV on apache.org On Jul 23, 2008, at 3:24 PM, Randall Leeds wrote: > On Wed, Jul 23, 2008 at 3:01 PM, Damien Katz > wrote: > >> document creation. The problem is the generated id for the document >> is a >> UUID generated server side, so the server has no way to distinguish >> if a >> request is a new request or a resend of an already processed >> request, and so >> generates another UUID and thus creates another new document. But >> if the >> UUID is generated by the client, then the resend will cause a >> conflict >> error, that UUID already exists in the DB, thus eliminating the >> duplicate >> data. >> > > It seems to me the easiest solution is that the client should > probably be > responsible for generating UUIDs. > Is there a counter-argument that indicates CouchDB being responsible > for > this? The only one I come up with quickly is that it puts an extra > burden on > the client. Not such a huge burden though. As far as the server > goes, client > generation seems to adhere to the wonderful tenet K.I.S.S. > The only problem with this approach is there is no standard way of generating a UUID in a browser. CouchDB uses a crypto level RNG to create the UUIDs, which is pretty much mandatory to minimize spurious conflicts. But generating true UUIDs isn't possible in most browsers (the entropy of the browser PRNG generator is usually significantly below the 128 bits possible for a UUID). One idea is CouchDB can generate the UUID still in a separate step. So the client first asks the server to generate a UUID, then the client uses that UUID to save the document. It's inefficient in that it would require two transactions, but it can make this more efficient if the client library (e.g couch.js) pre-requests UUIDs in bulk, and then keeps the un-used ones around in memory until more are needed. -Damien