You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Marcel Reutegger (JIRA)" <ji...@apache.org> on 2015/01/19 11:35:35 UTC

[jira] [Commented] (OAK-2411) Upgrade may fail with constraint exception

    [ https://issues.apache.org/jira/browse/OAK-2411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14282368#comment-14282368 ] 

Marcel Reutegger commented on OAK-2411:
---------------------------------------

While {{NodeStateDiff.childNodeChanged()}} mentions that the method may be called even though the child node did not change, the method {{Editor.childNodeChanged()}} does not say anything about this.

Created OAK-2413 to clarify {{Editor.childNodeChanged()}}.

As an immediate fix, I will change the initializer implementations to squeeze the base state for the MemoryNodeStore. This will avoid the issue where MemoryNodeStates are compared with ModifiedNodeStates.

> Upgrade may fail with constraint exception
> ------------------------------------------
>
>                 Key: OAK-2411
>                 URL: https://issues.apache.org/jira/browse/OAK-2411
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.0.9, 1.1.4
>            Reporter: Marcel Reutegger
>            Assignee: Marcel Reutegger
>            Priority: Minor
>             Fix For: 1.0.10, 1.1.5
>
>
> A repository upgrade to MongoMK sometimes fails with a constraint exception in PrivilegeValidator.childNodeChanged():
> {noformat}
> 18074 [main] ERROR org.apache.jackrabbit.oak.security.user.UserInitializer - Failed to initialize user content.
> org.apache.jackrabbit.oak.api.CommitFailedException: OakConstraint0041: Attempt to modify existing privilege definition jcr:nodeTypeManagement
> 	at org.apache.jackrabbit.oak.security.privilege.PrivilegeValidator.childNodeChanged(PrivilegeValidator.java:109)
> 	at org.apache.jackrabbit.oak.security.privilege.PrivilegeValidator.childNodeChanged(PrivilegeValidator.java:47)
> 	at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:143)
> 	at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState.compareAgainstBaseState(MemoryNodeState.java:155)
> {noformat}
> The problem is related to the way {{NodeStateDiff.childNodeChanged()}} is specified:
> bq. Called for all child nodes that *may* contain changes between the before and after states. The comparison implementation is expected to make an effort to avoid calling this method on child nodes under which nothing has changed.
> When the upgrade runs, {{PriviledgeValidator.childNodeChanged()}} is called even though there isn't actually a difference between the before and after state.
> On merge() the MemoryNodeStore squeezes the current NodeState (in {{MemoryNodeStoreBranch.setRoot()}}). This operation turns ModifiedNodeStates into equivalent MemoryNodeStates. When the hooks later process the changes, the node state comparison happens for a state that was squeezed with one that wasn't. This leads to {{MemoryNodeState.compareAgainstBaseState()}} calls where {{after != before}} and therefore {{diff.childNodeChanged()}} is called, even though the actual data of the states are equal.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)