[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16926637#comment-16926637 ] Thomas Mueller commented on OAK-8579: - http://svn.apache.org/r1866752 (trunk) > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Assignee: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16926636#comment-16926636 ] Thomas Mueller commented on OAK-8579: - [~catholicon] I'm not sure if there is an easy way for this... I think it currently is only a problem for index nodes, so I think the current solution is OK for now. > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Assignee: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16917572#comment-16917572 ] Vikas Saurabh commented on OAK-8579: [~tmueller], I was thinking about this issue after we discussed "fix validator approach". I wonder if another way could (should??) be for diff to not report "magically appearing node to not be reported in {{childNodeAdded}}". I do see that this is more hacky - but what I'm really trying to evaluate "should this new type of node incarnation be treated differently than simple child node addition". wdyt? > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16917558#comment-16917558 ] Thomas Mueller commented on OAK-8579: - > inadvertently ignoring/skipping some needed check here [~nitigup] the changes only affect hidden nodes (NodeStateUtils.isHidden(name)). With the JCR API it is not possible to create or access hidden nodes. So I believe it is not a risk. > we can reproduce this and see why this check is only coming into picture when > index is getting created in read only part of the repo This we know. But it is good to explicitly describe the problem: assume you create an index exists in the read-only part of the repo, using the "composite seed" mode, then the some hidden nodes are created by indexing. But only in the so called "read-only" repository. It is not actually read-only in this mode. But it is stored in a different segment store. If you investigate, for example with oak-run explore, how this repository looks like, you would see something like this {noformat} /oak:index/abc /oak:index/abc/:oak:mount-readOnlyV1-index-data {noformat} It is not yet created in the read-write repository. So when starting the composite store that opens the read-only repo in read-only mode, and the read-write repo in read-write mode, the nodes above are not visible. Now, assume you create an index in the read-write repo with this name: {noformat} /oak:index/abc {noformat} It is not yet indexing at that time, just storing the node itself. (Possibly you could even create a node of any other type, for example nt:base, so not an index definition node - I didn't test). What happens is: the hidden node /oak:index/abc/:oak:mount-readOnlyV1-index-data will now become visible, due to how the composite node store works and is configured. For Oak, it will looks like the node /oak:index/abc/:oak:mount-readOnlyV1-index-data was just added by the user (which is impossible to do using the JCR API, but the Oak verifiers don't know that). So the verifiers currently check if this node is a correct JCR node. It's not: the primary type is not set, so is "null". To resolve this issue, I changed the verifiers to ignore hidden nodes. > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16917505#comment-16917505 ] Robert Munteanu commented on OAK-8579: -- [~tmueller] - sorry, I am too disconnected from these changes to feel confident that I can review them. > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16917381#comment-16917381 ] Nitin Gupta commented on OAK-8579: -- [~tmueller] - One concern that I have here is we might be inadvertently ignoring/skipping some needed check here . "The primary type null does not exist" ->Maybe with some test case (trying to create a node with the higher level jcr api without specifying the primary type (forcing it to use default)) , we can reproduce this and see why this check is only coming into picture when index is getting created in read only part of the repo > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16916682#comment-16916682 ] Thomas Mueller commented on OAK-8579: - [~tihom88] [~nitigup] [~catholicon] could you review the patch above? For the change in NameValidator and TypeEditor: [~stillalex] and [~rombert] you might be a good reviewer, as the latest changes in those areas were from you. > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first
[ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16916605#comment-16916605 ] Thomas Mueller commented on OAK-8579: - Potential patch (need to run more tests): {noformat} Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java === --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java (revision 1864607) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NameValidator.java (working copy) @@ -30,6 +30,7 @@ import org.apache.jackrabbit.oak.spi.commit.Validator; import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer; import org.apache.jackrabbit.oak.spi.state.NodeState; +import org.apache.jackrabbit.oak.spi.state.NodeStateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -172,7 +173,9 @@ @Override public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException { -checkValidName(name); +if (!NodeStateUtils.isHidden(name)) { +checkValidName(name); +} return this; } Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java === --- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java (revision 1864607) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditor.java (working copy) @@ -475,6 +475,9 @@ } if (!names.isEmpty()) { for (String name : names) { +if (NodeStateUtils.isHidden(name)) { +continue; +} NodeState child = after.getChildNode(name); String primary = child.getName(JCR_PRIMARYTYPE); Iterable mixins = child.getNames(JCR_MIXINTYPES); Index: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreLuceneIndexTest.java === --- oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreLuceneIndexTest.java (revision 1864609) +++ oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreLuceneIndexTest.java (working copy) @@ -109,14 +109,14 @@ * but can be worked upon (improved) in the future . */ @Test -public void tryAddIndexInReadWriteWithIndexExistinginReadOnly() { -try { +public void tryAddIndexInReadWriteWithIndexExistinginReadOnly() throws Exception { +//try { repoV1.setupIndexAndContentInRepo("luceneTest", "foo", true, VERSION_1); -assertTrue(false); -} catch (Exception e) { -assert (e.getLocalizedMessage().contains( -"OakConstraint0001: /oak:index/luceneTest/:oak:mount-readOnlyV1-index-data[[]]: The primary type null does not exist")); -} +//assertTrue(false); +//} catch (Exception e) { +//assert (e.getLocalizedMessage().contains( +//"OakConstraint0001: /oak:index/luceneTest/:oak:mount-readOnlyV1-index-data[[]]: The primary type null does not exist")); +//} } {noformat} > Composite Node Store: Allow creating an index in the read-only repo first > - > > Key: OAK-8579 > URL: https://issues.apache.org/jira/browse/OAK-8579 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: composite, core, indexing, lucene >Reporter: Thomas Mueller >Priority: Major > > Currently, it is not allowed to first create a new index in the read-only > repository, and then in the read-write repository. Trying to do so will fail > with "OakConstraint0001: /oak:index/.../:oak:mount-readOnlyV1-index-data[[]]: > The primary type null does not exist" > See OAK-7917: oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite - > CompositeNodeStoreLuceneIndexTest.java > tryAddIndexInReadWriteWithIndexExistinginReadOnly line 112. > It would be better to allow this use case, to reduce the possibility of > problems. > We should specially test with lucene indexes, but also with property indexes. > (If that's more complicated, we can concentrate on the lucene case first.) -- This message was sent by Atlassian Jira (v8.3.2#803003)