Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-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 583D07C8A for ; Thu, 1 Dec 2011 13:26:44 +0000 (UTC) Received: (qmail 18370 invoked by uid 500); 1 Dec 2011 13:26:43 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 18314 invoked by uid 500); 1 Dec 2011 13:26:43 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 18307 invoked by uid 99); 1 Dec 2011 13:26:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2011 13:26:43 +0000 X-ASF-Spam-Status: No, hits=-1.6 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [64.18.1.21] (HELO exprod6og108.obsmtp.com) (64.18.1.21) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2011 13:26:36 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob108.postini.com ([64.18.5.12]) with SMTP ID DSNKTteAdrGFYSQe7Iy/TC/gNuA0ToOm92jd@postini.com; Thu, 01 Dec 2011 05:26:15 PST Received: from inner-relay-4.eur.adobe.com (inner-relay-4b [10.128.4.237]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id pB1DQDZc014918 for ; Thu, 1 Dec 2011 05:26:13 -0800 (PST) Received: from nacas01.corp.adobe.com (nacas01.corp.adobe.com [10.8.189.99]) by inner-relay-4.eur.adobe.com (8.12.10/8.12.9) with ESMTP id pB1DQDRH002287 for ; Thu, 1 Dec 2011 05:26:13 -0800 (PST) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nacas01.corp.adobe.com (10.8.189.99) with Microsoft SMTP Server (TLS) id 8.3.192.1; Thu, 1 Dec 2011 05:26:12 -0800 Received: from susi.local (10.136.169.103) by eurhub01.eur.adobe.com (10.128.4.111) with Microsoft SMTP Server id 8.3.192.1; Thu, 1 Dec 2011 13:26:07 +0000 Message-ID: <4ED7806E.5010402@apache.org> Date: Thu, 1 Dec 2011 13:26:06 +0000 From: =?ISO-8859-1?Q?Michael_D=FCrig?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Subject: Re: [jr3 microkernel] Write skew References: <4ED63BEE.6010904@apache.org> <4ED751DC.8070606@apache.org> <4ED76F55.3030001@apache.org> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 1.12.11 13:01, Jukka Zitting wrote: > Hi, > > On Thu, Dec 1, 2011 at 1:13 PM, Michael D�rig wrote: >> But this will introduce a race condition. With other words: this only make >> the time window during which such a inconsistency could slip in smaller. I >> think what we'd really need is an atomic test and set operation. > > Right, either the refresh-check-persist model for save() needs to be > atomic (possibly with optimistic locking as described) or we need an > eventual consistency model that can automatically resolve such > conflicts. > > Has this already been thought about? How does the current microkernel > implementation handle such cases? Currently the microkernel does nothing about this. That's what this whole discussion is about after all ;-) Eventually consistent approaches are IMO very hard to get right with JCR since most operation are assumed to be persisted after dispatch. One solution I see is to have changes caused by conflict resolution (i.e. during convergence) to appear as normal changes as if they where done by other sessions (see [1]). This would however require changing the revision model of the microkernel from linear shaped to tree shaped. For the current problem I'd rather have the microkernel to expose some test-and-set semantics as Tom describes in [2]. That way a client of the microkernel could apply changes atomically. A third and most general solution which puts away with write skew for good is described in [3]. This requires examining the commit log for certain read-write conflicts on save. Michael [1] http://wiki.apache.org/jackrabbit/Clustering%20the%20Microkernel#Replication [2] http://markmail.org/message/c32jpeoxklgcrybr [3] http://dl.acm.org/citation.cfm?id=1376690