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 "Julian Reschke (JIRA)" <ji...@apache.org> on 2018/05/29 07:00:05 UTC

[jira] [Comment Edited] (OAK-7512) RestoreTest.testRestoreNameJcr2 occasionally failing

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

Julian Reschke edited comment on OAK-7512 at 5/29/18 7:00 AM:
--------------------------------------------------------------

Hacked the test as below:
{noformat}
    public void testRestoreNameJcr2() throws RepositoryException,
            NotExecutableException {
        // V1.0 of versionableNode has no child
        Node child1 = versionableNode.addNode(nodeName4);
        ensureMixinType(child1, mixVersionable);
        versionableNode.getSession().save();
        // create v1.0 of child
        Version v1Child = versionManager.checkin(child1.getPath());

        // V1 of versionable node has child1
        String v1 = versionManager.checkin(versionableNode.getPath()).getName();
        String x1 = versionableNode.getBaseVersion().getProperty("jcr:created").getString();

        // create V1.1 of child
        versionManager.checkout(child1.getPath());
        Node child11 = versionManager.checkin(child1.getPath());
        String x11 = child11.getProperty("jcr:created").getString();

        // V2 of versionable node has child1
        versionManager.checkout(versionableNode.getPath());
        String v2 = versionManager.checkin(versionableNode.getPath()).getName();

        // restore 1.0 of versionable node --> no child
        versionManager.restore(version, true);
        System.err.println(x1 + " " + x11);
        assertFalse("restore must remove child node.", versionableNode.hasNode(nodeName4));
        System.err.println("ok");

        // restore V1 via name. since child was checkin first, 1.0 should be restored
        versionManager.restore(versionableNode.getPath(), v1, true);
        assertTrue("restore must restore child node.", versionableNode.hasNode(nodeName4));
        child1 = versionableNode.getNode(nodeName4);
        assertEquals("restore must restore child node version 1.0.", v1Child.getName(), versionManager.getBaseVersion(child1.getPath()).getName());

        // JSR283 is more clear about restoring versionable OPV=VERSION nodes
        // and states that an existing one is not restored when the parent
        // is restored (see 15.7.5 Chained Versions on Restore)

        // New JSR283 version:
        // restore V2 via name. child should still be be 1.0
        versionManager.restore(versionableNode.getPath(), v2, true);
        child1 = versionableNode.getNode(nodeName4);
        assertEquals("Node.restore('foo') must not restore child node and keep version 1.0.", v1Child.getName(), versionManager.getBaseVersion(child1.getPath()).getName());
    }
{noformat}

Observations:

- I got a few fails on Fixture.DOCUMENT_MEM
- when it fails, it's because the two version nodes of the child nodes have the same time stamp (which they are not supposed to have, due to the way the DateVersionSelector works)


was (Author: reschke):
Hacked the test as below:
{noformat}
    public void testRestoreNameJcr2() throws RepositoryException,
            NotExecutableException {
        // V1.0 of versionableNode has no child
        Node child1 = versionableNode.addNode(nodeName4);
        ensureMixinType(child1, mixVersionable);
        versionableNode.getSession().save();
        // create v1.0 of child
        Version v1Child = versionManager.checkin(child1.getPath());

        // V1 of versionable node has child1
        String v1 = versionManager.checkin(versionableNode.getPath()).getName();
        String x1 = versionableNode.getBaseVersion().getProperty("jcr:created").getString();

        // create V1.1 of child
        versionManager.checkout(child1.getPath());
        Node child11 = versionManager.checkin(child1.getPath());
        String x11 = child11.getProperty("jcr:created").getString();

        // V2 of versionable node has child1
        versionManager.checkout(versionableNode.getPath());
        String v2 = versionManager.checkin(versionableNode.getPath()).getName();

        // restore 1.0 of versionable node --> no child
        versionManager.restore(version, true);
        System.err.println(x1 + " " + x11);
        assertFalse("restore must remove child node.", versionableNode.hasNode(nodeName4));
        System.err.println("ok");

        // restore V1 via name. since child was checkin first, 1.0 should be restored
        versionManager.restore(versionableNode.getPath(), v1, true);
        assertTrue("restore must restore child node.", versionableNode.hasNode(nodeName4));
        child1 = versionableNode.getNode(nodeName4);
        assertEquals("restore must restore child node version 1.0.", v1Child.getName(), versionManager.getBaseVersion(child1.getPath()).getName());

        // JSR283 is more clear about restoring versionable OPV=VERSION nodes
        // and states that an existing one is not restored when the parent
        // is restored (see 15.7.5 Chained Versions on Restore)

        // New JSR283 version:
        // restore V2 via name. child should still be be 1.0
        versionManager.restore(versionableNode.getPath(), v2, true);
        child1 = versionableNode.getNode(nodeName4);
        assertEquals("Node.restore('foo') must not restore child node and keep version 1.0.", v1Child.getName(), versionManager.getBaseVersion(child1.getPath()).getName());
    }
{noformat}

Observations:

- I got a few fails on Fixture.DOCUMENT_MEM
- when it fails, it's because the two version nodes of the child nodes have the same time stamp /(which they are not supposed to have, due to the way the DateVersionSelector works)

> RestoreTest.testRestoreNameJcr2 occasionally failing
> ----------------------------------------------------
>
>                 Key: OAK-7512
>                 URL: https://issues.apache.org/jira/browse/OAK-7512
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: jcr
>    Affects Versions: 1.6.11, 1.9.2
>            Reporter: Julian Reschke
>            Assignee: Marcel Reutegger
>            Priority: Minor
>
> This tests occasionally fails for me:
> {noformat}
> testRestoreNameJcr2(org.apache.jackrabbit.test.api.version.RestoreTest): restore must restore child node version 1.0. expected:<1.[0]> but was:<1.[1]>
> {noformat}
> I *suspect* it is timing related (because it seems to happen more frequently when the system is busy).
> Last seen on 1.6 branch.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)