From oak-issues-return-74412-archive-asf-public=cust-asf.ponee.io@jackrabbit.apache.org Tue Aug 27 12:38:02 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3E647180654 for ; Tue, 27 Aug 2019 14:38:02 +0200 (CEST) Received: (qmail 19891 invoked by uid 500); 27 Aug 2019 12:38:01 -0000 Mailing-List: contact oak-issues-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-issues@jackrabbit.apache.org Received: (qmail 19880 invoked by uid 99); 27 Aug 2019 12:38:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Aug 2019 12:38:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C7DBCE2FE5 for ; Tue, 27 Aug 2019 12:38:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 2897178054F for ; Tue, 27 Aug 2019 12:38:00 +0000 (UTC) Date: Tue, 27 Aug 2019 12:38:00 +0000 (UTC) From: "Thomas Mueller (Jira)" To: oak-issues@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (OAK-8579) Composite Node Store: Allow creating an index in the read-only repo first MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OAK-8579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16916605#comment-16916605 ] Thomas Mueller edited comment on OAK-8579 at 8/27/19 12:37 PM: --------------------------------------------------------------- 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) @@ -103,20 +103,13 @@ } /** - * Given a composite node store , trying to create an index in read-write part - * with the same index node already existing in the read only part already - * we should get OakConstraint001 . This is the current behaviour, - * but can be worked upon (improved) in the future . + * Given a composite node store , create an index in read-write part + * with the same index node already existing in the read-only part already. */ @Test - public void tryAddIndexInReadWriteWithIndexExistinginReadOnly() { - 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")); - } + public void addIndexInReadWriteWithIndexExistinginReadOnly() throws Exception { + repoV1.setupIndexAndContentInRepo("luceneTest", "foo", true, VERSION_1); + repoV1.cleanup(); } /** {noformat} was (Author: tmueller): 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)