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 BA20FEDB5 for ; Tue, 15 Jan 2013 11:53:01 +0000 (UTC) Received: (qmail 93343 invoked by uid 500); 15 Jan 2013 11:53:01 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 93210 invoked by uid 500); 15 Jan 2013 11:52:59 -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 93168 invoked by uid 99); 15 Jan 2013 11:52:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 11:52:58 +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.208] (HELO exprod6og107.obsmtp.com) (64.18.1.208) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jan 2013 11:52:50 +0000 Received: from outbound-smtp-1.corp.adobe.com ([192.150.11.134]) by exprod6ob107.postini.com ([64.18.5.12]) with SMTP ID DSNKUPVC/NGUJtyJqvXKjTYKguTO7YuVbV1C@postini.com; Tue, 15 Jan 2013 03:52:29 PST Received: from inner-relay-1.corp.adobe.com ([153.32.1.51]) by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r0FBnS1v022985 for ; Tue, 15 Jan 2013 03:49:28 -0800 (PST) Received: from nacas03.corp.adobe.com (nacas03.corp.adobe.com [10.8.189.121]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r0FBqSAV018665 for ; Tue, 15 Jan 2013 03:52:28 -0800 (PST) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nacas03.corp.adobe.com (10.8.189.121) with Microsoft SMTP Server (TLS) id 8.3.297.1; Tue, 15 Jan 2013 03:52:27 -0800 Received: from susi.local (10.136.133.173) by eurhub01.eur.adobe.com (10.128.4.111) with Microsoft SMTP Server id 8.3.297.1; Tue, 15 Jan 2013 11:52:25 +0000 Message-ID: <50F542F9.8050906@apache.org> Date: Tue, 15 Jan 2013 11:52:25 +0000 From: =?ISO-8859-1?Q?Michael_D=FCrig?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Subject: Re: MicroKernelIT#conflictingMove References: <9C0FC4C8E9C29945B01766FC7F9D3898173DA498CC@eurmbx01.eur.adobe.com> <50F53B39.2060505@apache.org> In-Reply-To: <50F53B39.2060505@apache.org> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 15.1.13 11:19, Michael D�rig wrote: > > > On 15.1.13 10:23, Marcel Reutegger wrote: >> >>> I looked into why 2 tests failing in MicroKernelIT for MongoMK. One of >>> them is conflictingMove test. This test passes for MicroKernelImpl >>> and it >>> looks like the reason is MicroKernelImpl always commits against head. >>> Take >>> a look at CommitBuilder around line 112. There's a check whether >>> baseRevId >>> is not equal to currentHead, and if so, the staged tree is reset to >>> currentHead and the operation is retried. This effectively means that >>> the >>> operation is committed against head, right? >> >> hmm, not sure. I'd first have to look at the code. if it just blindly >> commits to >> head then it's certainly wrong and it also means it wouldn't detect the >> conflict, right? So, I guess what it does is some kind of rebase. > > Yes, the H2 MK does some kind of rebase if the commit is not against the > current head: it tries to reapply all changes against the current head > an later tries to merge the resulting changes into trunk. However this > results in a race condition. See > https://issues.apache.org/jira/browse/OAK-532 > >> >>> We recently changed CommitCommand to commit against baseRevisionId >>> instead >>> of head but I'm thinking maybe we should change it back to committing >>> against head? Or maybe we commit against baseRevisionId but we add some >>> kind of a conflicting commit detection (although I'm not too sure how >>> we'd >>> detect conflicting commits easily). WDYT? >> >> this is missing right now. merging with the *head* revision tree is >> done in >> CommitCommandNew.mergeNodes(). that is, mergeNodes() basically does >> the rebase I mentioned above. I recently added a FIXME to this method. >> I think this is the place where we'd need to find out if there is a >> conflict. >> > > In a nutshell here is what I think we should do: MK.commit should fail > on all but conflicts which are trivially merged. This will not be a > problem for oak-core since oak-core applies changes to private branches > and will merge these on Session.save. Before merging, branches are > rebased and that's the place where the more complicated conflict > handling should go. Due to rebasing the subsequent merge will not > conflict any more. > > See my POC work on https://issues.apache.org/jira/browse/OAK-536 for how > such a rebase operation could look like. Note that the current > implementation is not complete yet since it just throws an exception on > conflicts. I will soon update this to a more complete implementation > which correctly annotates conflicts such that oak-core can further > handle these. > Just updated the POC implementation to this respect. See https://github.com/mduerig/jackrabbit-oak/commits/OAK-536 and https://issues.apache.org/jira/browse/OAK-536?focusedCommentId=13553704&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13553704 Michael > Also note how such an implementation will also solve OAK-464 and OAK-548. > > Michael