You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Draier (JIRA)" <ji...@apache.org> on 2010/01/21 13:09:54 UTC

[jira] Created: (JCR-2474) Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared

Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared
-------------------------------------------------------------------------------------------------------------------

                 Key: JCR-2474
                 URL: https://issues.apache.org/jira/browse/JCR-2474
             Project: Jackrabbit Content Repository
          Issue Type: Sub-task
    Affects Versions: 2.0-beta6
            Reporter: Thomas Draier


Hi again,

Following the previous problem, when trying to remove one share of node D under B into ws1 , then merging A to ws2 completely removed the NodeState, even if it is still used under C.

After that, the system is an inconsistent state - as node C still have a D child, but the D node does have any NodeState anymore.

The issue can be located in VersionManagerImplMerge line 178 : calling :

state.getState().removeChildNodeEntry(entry.getId())

instead of :

state.removeNode(entry.getName(), entry.getIndex())

Regards


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2474) Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared

Posted by "Thomas Draier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Draier updated JCR-2474:
-------------------------------

    Status: Patch Available  (was: Open)

> Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2474
>                 URL: https://issues.apache.org/jira/browse/JCR-2474
>             Project: Jackrabbit Content Repository
>          Issue Type: Sub-task
>    Affects Versions: 2.0-beta6
>            Reporter: Thomas Draier
>
> Hi again,
> Following the previous problem, when trying to remove one share of node D under B into ws1 , then merging A to ws2 completely removed the NodeState, even if it is still used under C.
> After that, the system is an inconsistent state - as node C still have a D child, but the D node does have any NodeState anymore.
> The issue can be located in VersionManagerImplMerge line 178 : calling :
> state.getState().removeChildNodeEntry(entry.getId())
> instead of :
> state.removeNode(entry.getName(), entry.getIndex())
> Regards

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2474) Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared

Posted by "angela (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

angela updated JCR-2474:
------------------------

    Component/s: jackrabbit-core

> Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2474
>                 URL: https://issues.apache.org/jira/browse/JCR-2474
>             Project: Jackrabbit Content Repository
>          Issue Type: Sub-task
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta6
>            Reporter: Thomas Draier
>
> Hi again,
> Following the previous problem, when trying to remove one share of node D under B into ws1 , then merging A to ws2 completely removed the NodeState, even if it is still used under C.
> After that, the system is an inconsistent state - as node C still have a D child, but the D node does have any NodeState anymore.
> The issue can be located in VersionManagerImplMerge line 178 : calling :
> state.getState().removeChildNodeEntry(entry.getId())
> instead of :
> state.removeNode(entry.getName(), entry.getIndex())
> Regards

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-2474) Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared

Posted by "Thomas Draier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12803727#action_12803727 ] 

Thomas Draier commented on JCR-2474:
------------------------------------

Hi,

Here's a more complete patch about this bug - i rather changed NodeStateEx.removeNode() in order to check for shareable node - then also changed the case where we merge a shareable node somewhere else in the tree - instead of removing the node from its original location, it just adds a new share .

Regards


Index: src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java	(revision 812569)
+++ src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplMerge.java	(working copy)
@@ -37,10 +37,7 @@
 import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.security.authorization.Permission;
-import org.apache.jackrabbit.core.state.ChildNodeEntry;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.UpdatableItemStateManager;
+import org.apache.jackrabbit.core.state.*;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -183,16 +180,26 @@
         for (ChildNodeEntry entry: srcNode.getState().getChildNodeEntries()) {
             NodeStateEx child = state.getNode(entry.getName(), entry.getIndex());
             if (child == null) {
+                // create new child
+                NodeStateEx srcChild = srcNode.getNode(entry.getId());
                 // if destination workspace already has such an node, remove it
                 if (state.hasNode(entry.getId())) {
                     child = state.getNode(entry.getId());
-                    NodeStateEx parent = child.getParent();
-                    parent.removeNode(child);
-                    parent.store();
+                    if (!srcChild.getState().isShareable()) {
+                        NodeStateEx parent = child.getParent();
+                        parent.removeNode(child);
+                        parent.store();
+                        child = null;
+                    } else {
+                        child.getState().addShare(state.getNodeId());
+                        child.getState().setStatus(ItemState.STATUS_EXISTING_MODIFIED);
+                        child.store();
+                        state.getState().addChildNodeEntry(entry.getName(), child.getNodeId());
+                    }
                 }
-                // create new child
-                NodeStateEx srcChild = srcNode.getNode(entry.getId());
-                child = state.addNode(entry.getName(), srcChild.getState().getNodeTypeName(), srcChild.getNodeId());
+                if (child == null) {
+                    child = state.addNode(entry.getName(), srcChild.getState().getNodeTypeName(), srcChild.getNodeId());
+                }
                 child.setMixins(srcChild.getState().getMixinTypeNames());
                 // copy src child
                 state.store();
Index: src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java	(revision 812569)
+++ src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java	(working copy)
@@ -373,7 +373,14 @@
             if (entry == null) {
                 return false;
             } else {
-                removeNode(entry.getId());
+                NodeState child = (NodeState) stateMgr.getItemState(entry.getId());
+                if (child.getSharedSet().size() <= 1) {
+                    removeNode(entry.getId());
+                } else {
+                    child.removeShare(getNodeId());
+                    child.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
+                    store(child);
+                }
                 nodeState.removeChildNodeEntry(entry.getId());
                 nodeState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
                 return true;


> Removing shareable node from a workspace and merging to another one removes the nodestate even if it's still shared
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2474
>                 URL: https://issues.apache.org/jira/browse/JCR-2474
>             Project: Jackrabbit Content Repository
>          Issue Type: Sub-task
>    Affects Versions: 2.0-beta6
>            Reporter: Thomas Draier
>
> Hi again,
> Following the previous problem, when trying to remove one share of node D under B into ws1 , then merging A to ws2 completely removed the NodeState, even if it is still used under C.
> After that, the system is an inconsistent state - as node C still have a D child, but the D node does have any NodeState anymore.
> The issue can be located in VersionManagerImplMerge line 178 : calling :
> state.getState().removeChildNodeEntry(entry.getId())
> instead of :
> state.removeNode(entry.getName(), entry.getIndex())
> Regards

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.