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 "angela (JIRA)" <ji...@apache.org> on 2012/09/26 11:40:08 UTC

[jira] [Created] (OAK-343) Session.getNodeByUUID requires save call

angela created OAK-343:
--------------------------

             Summary: Session.getNodeByUUID requires save call
                 Key: OAK-343
                 URL: https://issues.apache.org/jira/browse/OAK-343
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: core, jcr
            Reporter: angela


while adding mix:referenceable to a new node immediately assigns a 
uuid and makes the node referenceable, session.getNodeByUUID only works
after saving the changes.

the following test illustrates this behavior:

@Test
    public void getNodeByUUID() throws RepositoryException {
        Node node = getNode("/foo").addNode("boo");
        node.addMixin(JcrConstants.MIX_REFERENCEABLE);

        assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
        String uuid = node.getUUID();
        assertNotNull(uuid);
        assertEquals(uuid, node.getIdentifier());

        Node nAgain = node.getSession().getNodeByUUID(uuid);
        assertTrue(nAgain.isSame(node));
          assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-343) Session.getNodeByUUID requires save call

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13463663#comment-13463663 ] 

angela commented on OAK-343:
----------------------------

the same applies to IdentifierManager#getTree and main issue behind is that uuid/identifier resolutions uses
the query which relies on an index that is only populated after changes have been saved.
                
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
>     public void getNodeByUUID() throws RepositoryException {
>         Node node = getNode("/foo").addNode("boo");
>         node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>         assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>         String uuid = node.getUUID();
>         assertNotNull(uuid);
>         assertEquals(uuid, node.getIdentifier());
>         Node nAgain = node.getSession().getNodeByUUID(uuid);
>         assertTrue(nAgain.isSame(node));
>           assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-343) Session.getNodeByUUID requires save call

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13463745#comment-13463745 ] 

angela commented on OAK-343:
----------------------------

well, since the uuid is created immediately and the node is referenceable as well,
i would expect that i could also get it by uuid.

second we have an issue with a backwards compatible user mgt implementation:
a NEW user used to be accessible by for the editing session even before commiting
it. second, since the tree object isn't stable it needs to be re-accessed during
the life-time of a user object. searching isn't possible but i would expect that
lookup be id was possible.
                
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
>     public void getNodeByUUID() throws RepositoryException {
>         Node node = getNode("/foo").addNode("boo");
>         node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>         assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>         String uuid = node.getUUID();
>         assertNotNull(uuid);
>         assertEquals(uuid, node.getIdentifier());
>         Node nAgain = node.getSession().getNodeByUUID(uuid);
>         assertTrue(nAgain.isSame(node));
>           assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-343) Session.getNodeByUUID requires save call

Posted by "angela (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13463749#comment-13463749 ] 

angela commented on OAK-343:
----------------------------

regarding the user mgt: i realized that when looking at failing test
that were originally written for jackrabbit and which i would expect
to pass (as long as the tests are not obviously buggy)
                
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
>     public void getNodeByUUID() throws RepositoryException {
>         Node node = getNode("/foo").addNode("boo");
>         node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>         assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>         String uuid = node.getUUID();
>         assertNotNull(uuid);
>         assertEquals(uuid, node.getIdentifier());
>         Node nAgain = node.getSession().getNodeByUUID(uuid);
>         assertTrue(nAgain.isSame(node));
>           assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OAK-343) Session.getNodeByUUID requires save call

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

angela updated OAK-343:
-----------------------

    Description: 
while adding mix:referenceable to a new node immediately assigns a 
uuid and makes the node referenceable, session.getNodeByUUID only works
after saving the changes.

the following test illustrates this behavior:

@Test
public void getNodeByUUID() throws RepositoryException {
   Node node = getNode("/foo").addNode("boo");
   node.addMixin(JcrConstants.MIX_REFERENCEABLE);

   assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
   String uuid = node.getUUID();
   assertNotNull(uuid);
   assertEquals(uuid, node.getIdentifier());

   Node nAgain = node.getSession().getNodeByUUID(uuid);
   assertTrue(nAgain.isSame(node));
   assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
}

  was:
while adding mix:referenceable to a new node immediately assigns a 
uuid and makes the node referenceable, session.getNodeByUUID only works
after saving the changes.

the following test illustrates this behavior:

@Test
    public void getNodeByUUID() throws RepositoryException {
        Node node = getNode("/foo").addNode("boo");
        node.addMixin(JcrConstants.MIX_REFERENCEABLE);

        assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
        String uuid = node.getUUID();
        assertNotNull(uuid);
        assertEquals(uuid, node.getIdentifier());

        Node nAgain = node.getSession().getNodeByUUID(uuid);
        assertTrue(nAgain.isSame(node));
          assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
    }

    
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
> public void getNodeByUUID() throws RepositoryException {
>    Node node = getNode("/foo").addNode("boo");
>    node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>    assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>    String uuid = node.getUUID();
>    assertNotNull(uuid);
>    assertEquals(uuid, node.getIdentifier());
>    Node nAgain = node.getSession().getNodeByUUID(uuid);
>    assertTrue(nAgain.isSame(node));
>    assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-343) Session.getNodeByUUID requires save call

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13463852#comment-13463852 ] 

Jukka Zitting commented on OAK-343:
-----------------------------------

Marcel brought up the good idea that there's no need for us to wait for the save() or the commit hook until the jcr:uuid index used by the getNodeByUUID() method gets updated. Instead we could update that index already in the transient space as soon as the UUID is assigned to a new, transient node. The index lookup then just needs to be done against the transient state of the tree instead of the persisted one.
                
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
> public void getNodeByUUID() throws RepositoryException {
>    Node node = getNode("/foo").addNode("boo");
>    node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>    assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>    String uuid = node.getUUID();
>    assertNotNull(uuid);
>    assertEquals(uuid, node.getIdentifier());
>    Node nAgain = node.getSession().getNodeByUUID(uuid);
>    assertTrue(nAgain.isSame(node));
>    assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-343) Session.getNodeByUUID requires save call

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13463697#comment-13463697 ] 

Jukka Zitting commented on OAK-343:
-----------------------------------

Do we need the UUIDs to be present and usable before a save()? The [relevant part|http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.3.1%20Identifier%20Assignment] of the JCR 2.0 spec says:  

bq. The identifier must be assigned at the latest when the node is first persisted, though it may be assigned earlier, when the node is first created in transient storage in the session.

                
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
>     public void getNodeByUUID() throws RepositoryException {
>         Node node = getNode("/foo").addNode("boo");
>         node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>         assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>         String uuid = node.getUUID();
>         assertNotNull(uuid);
>         assertEquals(uuid, node.getIdentifier());
>         Node nAgain = node.getSession().getNodeByUUID(uuid);
>         assertTrue(nAgain.isSame(node));
>           assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OAK-343) Session.getNodeByUUID requires save call

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504643#comment-13504643 ] 

Julian Reschke commented on OAK-343:
------------------------------------

Spec lawyering question: does the JCR spec allow an implementation to assign the identifier early but then fail getNodeByIdentifier()? It it's silent on that, we may want to clarify that in JSR 333.
                
> Session.getNodeByUUID requires save call
> ----------------------------------------
>
>                 Key: OAK-343
>                 URL: https://issues.apache.org/jira/browse/OAK-343
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, jcr
>            Reporter: angela
>
> while adding mix:referenceable to a new node immediately assigns a 
> uuid and makes the node referenceable, session.getNodeByUUID only works
> after saving the changes.
> the following test illustrates this behavior:
> @Test
> public void getNodeByUUID() throws RepositoryException {
>    Node node = getNode("/foo").addNode("boo");
>    node.addMixin(JcrConstants.MIX_REFERENCEABLE);
>    assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
>    String uuid = node.getUUID();
>    assertNotNull(uuid);
>    assertEquals(uuid, node.getIdentifier());
>    Node nAgain = node.getSession().getNodeByUUID(uuid);
>    assertTrue(nAgain.isSame(node));
>    assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira