From dev-return-18020-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Fri Sep 9 13:38:19 2011 Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CF6968CDC for ; Fri, 9 Sep 2011 13:38:19 +0000 (UTC) Received: (qmail 64848 invoked by uid 500); 9 Sep 2011 13:38:19 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 64709 invoked by uid 500); 9 Sep 2011 13:38:17 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 64700 invoked by uid 99); 9 Sep 2011 13:38:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 13:38:17 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.139.213.154] (HELO nm9-vm0.bullet.mail.bf1.yahoo.com) (98.139.213.154) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 09 Sep 2011 13:38:08 +0000 Received: from [98.139.212.148] by nm9.bullet.mail.bf1.yahoo.com with NNFMP; 09 Sep 2011 13:37:47 -0000 Received: from [98.139.212.228] by tm5.bullet.mail.bf1.yahoo.com with NNFMP; 09 Sep 2011 13:37:47 -0000 Received: from [127.0.0.1] by omp1037.mail.bf1.yahoo.com with NNFMP; 09 Sep 2011 13:37:47 -0000 X-Yahoo-Newman-Id: 591113.52282.bm@omp1037.mail.bf1.yahoo.com Received: (qmail 14330 invoked from network); 9 Sep 2011 13:37:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-Mailer; b=X2qbhKrUhfJzg2kD4m/3MknlAbSiedwplwIaHyIIXD6urdsH9Ks8t2yI0TEdjHlY4exSughBCQmZaGK/7NLoFOLq6hFb7+6puAafS8YAv/m+srituoSqEELMcZ2ofrE5PW7+fVwADBsP9oIb79d0i/ri7HpRVNCAfEJD6K54rU0= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1315575467; bh=bFWZNIEQu4DZWQn/5Xrepjz2S8E+p5ffgcgWAkdcQi8=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-Mailer; b=bO4+ogfIoMkHywg5mTStvwc5WK9+DdORmRe1BBtlOkvKlu1p/iLasOETNjnSaeNNVJ4XkSbR3Bn4JuigsNqQeVlfuhebugLVRg4jSskchwOgWm7ZzyRawQwjL+xOyz5mO1FvcAOb3xAQweRi3lTvwD+dVIdA7c1YUu0XfNj8Zeo= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: xdk296EVM1m_luSXIWVeG2xICpkc46Ydiadsv8PisIQrC1x r.3Fv.yCnP8SzvHqvuckjiD7xk9dLir6Is2_O78hAbc2UwauRisGaAToO0C6 2J1zTxnGWIPtX9q4gj3KyGfqNOQcakk6erxYkdPXYXWXZ_ZX4YOaDr8Puxtk 0.D81ANtkCatd41EYmhnopZDkOePEZiVbvdqZ8DcAWuG.MXXWYQurexc5Y2C d39HIaCD3GkJ.MEIKva7nobCl9Uby6WduupD6x05FuwoAUm2MXOz4Wk2NnHC GL5ytuYRDw.rNPwytYaEPiq_WXcIN4wwnWliutqzvsl17_UPZmM9CRAkEa6a kaZEYrVQsKZ8KuwZIL3NB2iKJiS5qRKQ8Ho93.92Q1luNBFlMr5vhdQlQFaf qRWhwtQteolIS0Gw- X-Yahoo-SMTP: S1pXUCOswBDw0OuVfiRY2JYRegF41C7v Received: from stylemac.lan (pepijndevos@77.164.81.181 with plain) by smtp101.mail.bf1.yahoo.com with SMTP; 09 Sep 2011 06:37:47 -0700 PDT From: Pepijn de Vos Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [proposal] Update Handler Conflict Resolution Date: Fri, 9 Sep 2011 15:37:45 +0200 Message-Id: <04419515-81B2-480D-A897-2BDD4EC8EFD5@yahoo.com> To: dev@couchdb.apache.org Mime-Version: 1.0 (Apple Message framework v1244.3) X-Mailer: Apple Mail (2.1244.3) Hi, Today I had a long and complicated discussion involving rnewson, = jan____, me and muhqu. I was falsely assuming Document Update Handlers did atomic updates. = Truth is that they don't, but for most of my use cases could. What currently happens is that the update handler gets executed with the = latest rev of the requested doc. When the update is completed, it is = committed, but when another update has meanwhile happened, a conflict = arises and 409 is returned. When I use update handlers, I mostly use idempotent functions. This = means that it is safe for the update handler to retry on its own = account, and in doing so, avoid a ton of latency and headaches. Only, it turns out that programmatic updates are not the sole use for = update handlers, so rnewson argued that it might destroy data. Proposal 1: Add an idempotent=3Dtrue parameter to the handler, allowing it to retry = on its own. Proposal 2: Add an update() function so the handler can handle conflicts in itself. I cannot program Erlang. I think I might be able to work out option 1, = but not 2. So if option 2 is desired, someone else will have to write = it. Pepijn=