[
https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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<String> 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)