jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-2740) On missing child node, automatically rename entry when trying to add a node with the same name
Date Thu, 11 Nov 2010 11:09:13 GMT

    [ https://issues.apache.org/jira/browse/JCR-2740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930986#action_12930986

Stefan Guggisberg commented on JCR-2740:

thanks for the patch, a few comments:

- i like the idea of automatically fixing inconsistencies when they're encountered;
  however, i am a bit concerned that the corresponding warnings in the log 
  don't get noticed and the user might be unaware of a repository becoming gradually 
  corrupt. i suggest to control the proposed behavior through a flag (e.g. a system property),
  and that this feature is disabled by default.

- there's a potential problem in the patched addNode() method.

+            // loop until we either find an existing child node,
+            // or we are sure no such child node exists
+            ChildNodeEntry cne = thisState.getChildNodeEntry(nodeName, 1);
+            existing = null;
+            if (cne != null) {
+                try {
+                    existing = itemMgr.getNode(cne.getId(), getNodeId());
+                } catch (ItemNotFoundException e) {
+                    // the item was removed in the persistence manager,
+                    // which is a repository inconsistency - there is nothing
+                    // we can do, so the child node entry is removed now
+                    log.warn("Node " + getPath() + "/" + cne.getName() + " " +
+                            "(index " + cne.getIndex() + ", id " + cne.getId() +
+                            "parent id " + getId() + ") " +
+                            "not found; removing", e);
+                    removeChildNode(cne.getId());
+                    continue;
+                }
+            }
  the existence is checked through the ItemManager which 
  depends on access control, i.e. an ItemNotFoundException might 
  be thrown because the current session is not allowed to read 
  that particular node...

> On missing child node, automatically rename entry when trying to add a node with the
same name
> ----------------------------------------------------------------------------------------------
>                 Key: JCR-2740
>                 URL: https://issues.apache.org/jira/browse/JCR-2740
>             Project: Jackrabbit Content Repository
>          Issue Type: New Feature
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>         Attachments: jcr-2740.patch
> If a node points to a non-existing child node (which is a repository inconsistency),
currently this child node is silently ignored for read operations (as far as I can tell).
However, when trying to add another child node with the same name, an exception is thrown
with a message saying a child node with this name already exists.
> I suggest to rename the missing child node entry in that case (for example add the current
date/time, or a random digit until there is no conflict), and then continue with adding the
new child node. I wouldn't automatically remove the bad entry, because the node might "appear"
later (after a restore), and because removing data from the repository seems wrong.
> It's not a perfect solution, but it might be better than throwing an exception and basically
preventing changes.

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

View raw message