jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Reschke (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCR-3016) inconsistent repository after overlapping node add operations
Date Thu, 07 Jul 2011 13:36:17 GMT

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

Julian Reschke commented on JCR-3016:
-------------------------------------

Another variant of the problem:

	public void testWithFolderAndFile() throws Exception {

		String testpath = testfolder.getPath();

		Node f1 = s1.getNode(testpath).addNode("foo", "nt:folder");
		Node c1 = f1.addNode("a", "nt:file");
		Node r1 = c1.addNode("jcr:content", "nt:resource");
		r1.setProperty("jcr:data", "foo");

		Node f2 = s2.getNode(testpath).addNode("foo", "nt:file");
		Node r2 = f2.addNode("jcr:content", "nt:resource");
		r2.setProperty("jcr:data", "bar");

		s1.save();

		try {
			s2.save();
		} catch (InvalidItemStateException ex) {
			// expected

			// retry; adding refresh doesn't change anything here
			try {
				s2.save();

			} catch (InvalidItemStateException ex2) {
				// we would be cool with this
			}
		}

		s1.refresh(false); // we don't have changes in s1, so the keepChanges
							// flag should be irrelevant
		f1 = s1.getNode(testpath + "/foo"); // be nice and get a new Node
												// instance

		assertEquals("nt:folder", f1.getPrimaryNodeType().getName());
	}

Here, session 1 creates a node of type nt:folder, session 2 tries to create an nt:file node.
For session 2, the 2nd save() succeeds, and the node created by session 1 disappears,

> inconsistent repository after overlapping node add operations
> -------------------------------------------------------------
>
>                 Key: JCR-3016
>                 URL: https://issues.apache.org/jira/browse/JCR-3016
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Julian Reschke
>         Attachments: OverlappingNodeAddTest.diff
>
>
> It seems I can reproduce a sequence of operations that cause the repository to be inconsistent.
> The short version: 2 sessions add a same-named child node to the same parent folder (not
allowing same-name-siblings). Session 1's save() succeeds. Session 2's save() fails, but succeeds
on retry (!).
> After the operation, the child node created by session 1 is still present, but the parent
doesn't list it as child node anymore.
> (will add test case)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message