[
https://issues.apache.org/jira/browse/OAK-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13529744#comment-13529744
]
Thomas Mueller commented on OAK-343:
------------------------------------
For me it's not actually about that getCost() gets called first, but in general
that getCost() is supposed to just calculate the cost, without side effects.
Even if this side effect is within the specification, it's just unusual and
unexpected. I would rather have a solution where getCost() only calculates the
cost :-) and the lookup is done within query(). I think we can find a solution.
It's also problematic that getCost() returns 0 so that the cost is smaller than
the cost of the regular jcr:uuid index. It does solve the problem, true, but
it's now the planned behavior.
About naming: I would probably call it "TransientUUIDIndex" because it operates
on the transient space. Later on, if we want to make it more generic, we could
call it "TransientIndex".
What about making it explicit in the query that the result should include
transient changes? So the query would be changed to "select ... from ... where
[jcr:uuid] = $id including transient". Then the QueryIndex interface would be
extended with a new method "boolean includesTransient". That way, if the query
is "including transient", the query engine would only use indexes that do
support transient changes.
I wonder if both the NodeState and Root given to the query actually include the
node?
> 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
> Attachments: oak-343.patch
>
>
> 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