Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C4B8310934 for ; Mon, 22 Jul 2013 10:36:34 +0000 (UTC) Received: (qmail 32546 invoked by uid 500); 22 Jul 2013 10:36:34 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 32499 invoked by uid 500); 22 Jul 2013 10:36:34 -0000 Mailing-List: contact oak-dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-dev@jackrabbit.apache.org Received: (qmail 32356 invoked by uid 99); 22 Jul 2013 10:36:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jul 2013 10:36:33 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [91.199.146.30] (HELO merkur.eye.ch) (91.199.146.30) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jul 2013 10:36:27 +0000 Received: from susi.fritz.box (178-83-205-93.dynamic.hispeed.ch [178.83.205.93]) by merkur.eye.ch with SMTP; Mon, 22 Jul 2013 12:35:38 +0200 Message-ID: <51ED0AFC.5080901@apache.org> Date: Mon, 22 Jul 2013 12:35:40 +0200 From: =?ISO-8859-1?Q?Michael_D=FCrig?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: oak-dev@jackrabbit.apache.org Subject: Re: Conflict handling causes spurious observation events References: <51E962BA.7040903@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 22.7.13 12:05, Jukka Zitting wrote: > Hi, > > On Fri, Jul 19, 2013 at 7:00 PM, Michael D�rig wrote: >> Chetan discovered that in some cases spurious observation events would be >> created when to sessions save concurrently. In a nutshell the problem occurs >> since the current implementation of observation [1] expects a linear >> sequence of revisions (per cluster node). However on Root.commit there is a >> small race between rebasing and merging a branch: when another session saves >> inside this time frame, its branch will have the same base revision like >> that of the former session. In this case the sequence of revisions is >> effectively non linear. > > If we move the logic from Root.commit() to NodeStoreBranch.merge(), we > should be able to prevent concurrent updates either by leveraging the > internal rebase logic in SegmentMK or by synchronizing on the > associated NodeStore instance. Yes I was thinking of something similar. For this to work we need to pass the post commit hook to NSB.merge(). I noticed that the SegmentMK handles this situation correctly. That is, it rebases before running the hooks and re-runs the hooks in case of a failure. It even incorporate some logic to fall back to pessimistic locking when optimistic locking fails. So moving the post commit hook to NSB.merge() should solve the problem when using the SegmentMK. For other NodeStore implementations I currently don't see how to reuse the code from SegmentMK without changing the contract of the Microkernel.merge method. As long as that method does its own merge magic we need to prevent concurrent merges in order to avoid the race condition. This means we'd need to synchronise on the NodeStore instance as you mention. But AFAIR we explicitly wanted to avoid this for scalability reasons. Michael > > BR, > > Jukka Zitting >