Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2120

Occasional data corruption in very specific circumstances with high degrees of write conflict

XMLWordPrintable

      Some data corruption has been observed in some situations where there are many concurrent sessions making lots of changes under the same nodes and when same-name-siblings are not allowed. Specifically, the following exception has been seen when attempting to add a child node below the existing "/customer/4bb/4bb6c0b4-647b-4180-a8f5-8b18d1c14ca7" node:

      Caused by: javax.jcr.nodetype.ConstraintViolationException: Cannot find a definition for a child named '{}4bb6c0b4-647b-4180-a8f5-8b18d1c14ca7' on the node at '/customer/4bb' with primary type 'acme:Hierarchy' and mixin types: []
        at org.modeshape.jcr.AbstractJcrNode.nodeDefinition(AbstractJcrNode.java:2931)
        at org.modeshape.jcr.AbstractJcrNode.getDefinition(AbstractJcrNode.java:2849)
        at org.modeshape.jcr.AbstractJcrNode.isCheckedOut(AbstractJcrNode.java:3241)
        at org.modeshape.jcr.AbstractJcrNode.addChildNode(AbstractJcrNode.java:1126)
        at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:1066)
        at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:980)
        at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:108)
        ...
      

      The "acme:Hierarchy" node at "/customer/4bb" is the grand-parent of the new node, and is a simple container node that does not allow same-name siblings for the residual node definition. The new node's parent node (e.g., "/customer/4bb/4bb6c0b4-647b-4180-a8f5-8b18d1c14ca7") exists and has been persisted, but it's parent's document contains two child references to the same child node (with the same key). Therefore, when the AbstractJcrNode.nodeDefinition() method attempts to find an appropriate child node definition for the child, it discovers that there are 2 child references with the same name (again, they both point to the same child node), and the node definition does not allow SNS resulting in the ConstraintViolationException.

      It is not clear how the grandparent of the new node came to contain duplicate child references to the same node (e.g., parent of the new node). But it is clear that having this unexpected situation in the document results in poor and unexpected behavior.

              rhauch Randall Hauch (Inactive)
              rhauch Randall Hauch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: