jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: SessionTest.testSaveInvalidStateException vs OAK
Date Wed, 06 Jun 2012 15:48:59 GMT
Hi,

On Wed, Jun 6, 2012 at 5:16 PM, Michael Dürig <mduerig@apache.org> wrote:
> On 6.6.12 14:20, Julian Reschke wrote:
>> At first glance, this seems to be another case of where the test needs
>> to refresh() before saving, because in Oak, the session doesn't
>> necessarily have the latest changes.
>
> This is necessary in any case and should be fixed in the test case.

The test is IMHO fine, what we need is Session.save() to do an
implicit refresh() (or an equivalent rebase operation) before
committing transient changes. In fact IIUC that's already the case
here.

> This is caused by the way refresh(true) is currently implemented. It does
> basically a rebase operation: it re-applies all changes of the current
> session to the current trunk. Now when a node does not exist any more in
> trunk and there are changes to the sub tree rooted at that node, these
> changes are silently discarded.

Perhaps we should replace such cases with conflict markers that
prevent the transient space from being resolved (for example with a
commit hook that prevents such markers from being present in commit).
Only if the session then explicitly removes or re-adds the modified
subtree, thus clearing the conflict marker, can the save succeed.

BR,

Jukka Zitting

Mime
View raw message