Author: davide
Date: Wed Dec 16 15:35:28 2015
New Revision: 1720375
URL: http://svn.apache.org/viewvc?rev=1720375&view=rev
Log:
OAK-3768 - Remove OrderedPropertyIndex support from trunk
- tracking a warning every 10000 inserts/queries if the providers are available.
Added:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProviderTest.java
Removed:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndex.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditor.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexLookup.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/BasicOrderedPropertyIndexQueryTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/LowCostOrderedPropertyIndexProvider.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Oak2077QueriesTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderDirectionEnumTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndexCostTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndexQueryTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexDescendingQueryTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexQueryTest.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderedIndexConcurrentClusterIT.java
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderedIndexIT.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndex.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProvider.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProvider.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/package-info.java
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndex.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndex.java?rev=1720375&r1=1720374&r2=1720375&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndex.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedIndex.java
Wed Dec 16 15:35:28 2015
@@ -29,6 +29,20 @@ import org.apache.jackrabbit.oak.spi.sta
*/
public interface OrderedIndex {
/**
+ * Deprecation message tracked when using the ordered index.
+ */
+ String DEPRECATION_MESSAGE =
+ "Ordered Index has been deprecated since Oak 1.1.8. " +
+ "Please replace the index definitions with Lucene Property index " +
+ "and remove the index providers from the repository. " +
+ "See docs at http://jackrabbit.apache.org/oak/docs";
+
+ /**
+ * the deprecation message will be tracked every N times
+ */
+ int TRACK_DEPRECATION_EVERY = 10000;
+
+ /**
* enum for easing the order direction of the index
*/
enum OrderDirection {
@@ -123,35 +137,5 @@ public interface OrderedIndex {
/**
* the default direction for sorting the index
*/
- OrderDirection DEFAULT_DIRECTION = OrderDirection.ASC;
-
- /**
- * defines the default distribution of items across the skip list. It's
with a factor of 10%
- * having therefore
- *
- * <dl>
- * <dt>lane 0:</dt> <dd>100.0% (the base linked list)</dd>
- * <dt>lane 1:</dt> <dd>10.0%</dd>
- * <dt>lane 2:</dt> <dd>1.0%</dd>
- * <dt>lane 3:</dt> <dd>0.1%</dd>
- * </dl>
- */
- double DEFAULT_PROBABILITY = Integer.getInteger("oak.orderedIndex.prob",
3) / 10.0;
-
- /**
- * the number of lanes used in the SkipList
- */
- int LANES = Integer.getInteger("oak.orderedIndex.lanes", 15);
-
- /**
- * Convenience Predicate that will force the implementor to expose what
we're searching for
- *
- * @param <T>
- */
- interface Predicate<T> extends com.google.common.base.Predicate<T> {
- /**
- * @return the string we're searching for during this predicate
- */
- String getSearchFor();
- }
+ OrderDirection DEFAULT_DIRECTION = OrderDirection.ASC;
}
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProvider.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProvider.java?rev=1720375&r1=1720374&r2=1720375&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProvider.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProvider.java
Wed Dec 16 15:35:28 2015
@@ -21,6 +21,7 @@ import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
import org.apache.felix.scr.annotations.Service;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
@@ -28,15 +29,39 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.spi.commit.Editor;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-@Component
+@Component(policy = ConfigurationPolicy.REQUIRE)
@Service(IndexEditorProvider.class)
public class OrderedPropertyIndexEditorProvider implements
IndexEditorProvider, OrderedIndex {
+ private static final Logger LOG =
LoggerFactory.getLogger(OrderedPropertyIndexEditorProvider.class);
+ private static int hits;
+ private static int threshold = OrderedIndex.TRACK_DEPRECATION_EVERY;
@Override
@CheckForNull
- public Editor getIndexEditor(@Nonnull String type, @Nonnull NodeBuilder
definition, @Nonnull NodeState root, @Nonnull IndexUpdateCallback callback)
throws CommitFailedException {
- Editor editor = (TYPE.equals(type)) ? new
OrderedPropertyIndexEditor(definition,root,callback) : null;
- return editor;
+ public Editor getIndexEditor(@Nonnull String type,
+ @Nonnull NodeBuilder definition,
+ @Nonnull NodeState root,
+ @Nonnull IndexUpdateCallback callback) throws
CommitFailedException {
+ if (OrderedIndex.TYPE.equals(type)) {
+ if (hit() % threshold == 0) {
+ LOG.warn(OrderedIndex.DEPRECATION_MESSAGE);
+ }
+ }
+ return null;
+ }
+
+ private synchronized int hit() {
+ return hits++;
+ }
+
+ /**
+ * used for testing purposes. Not thread safe.
+ * @param t
+ */
+ static void setThreshold(int t) {
+ threshold = t;
}
}
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProvider.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProvider.java?rev=1720375&r1=1720374&r2=1720375&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProvider.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProvider.java
Wed Dec 16 15:35:28 2015
@@ -17,63 +17,44 @@
package org.apache.jackrabbit.oak.plugins.index.property;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
+import static com.google.common.collect.Lists.newArrayList;
-import javax.annotation.Nonnull;
+import java.util.List;
import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
import org.apache.felix.scr.annotations.Service;
import org.apache.jackrabbit.oak.spi.query.QueryIndex;
import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import com.google.common.collect.ImmutableList;
-
-@Component
+@Component(policy = ConfigurationPolicy.REQUIRE)
@Service(QueryIndexProvider.class)
public class OrderedPropertyIndexProvider implements QueryIndexProvider {
-
- private static final long DEFAULT_NO_INDEX_CACHE_TIMEOUT =
TimeUnit.SECONDS.toMillis(30);
-
- /**
- * How often it should check for a new ordered property index.
- */
- private static long noIndexCacheTimeout = DEFAULT_NO_INDEX_CACHE_TIMEOUT;
-
- /**
- * The last time when it checked for the existence of an ordered property
index AND could not find any.
- */
- private volatile long lastNegativeIndexCheck;
-
+ private static final Logger LOG =
LoggerFactory.getLogger(OrderedPropertyIndexProvider.class);
+ private static int hits;
+ private static int threshold = OrderedIndex.TRACK_DEPRECATION_EVERY;
+
@Override
- @Nonnull
public List<? extends QueryIndex> getQueryIndexes(NodeState nodeState) {
- return ImmutableList.<QueryIndex> of(new OrderedPropertyIndex(this));
+ if (getHits() % threshold == 0) {
+ LOG.warn(OrderedIndex.DEPRECATION_MESSAGE);
+ }
+ return newArrayList();
}
-
- /**
- * @return <code>true</code> if there may be any ordered indexes below the
root path
- */
- boolean mayHaveRootIndexes() {
- return System.currentTimeMillis() - lastNegativeIndexCheck >
noIndexCacheTimeout;
+
+ private synchronized int getHits() {
+ return hits++;
}
-
+
/**
- * Indicates whether or not there are ordered indexes below the root path
- *
- * @param hasRootIndexes
+ * used only for testing purposes. Not thread safe.
+ *
+ * @param t
*/
- void indicateRootIndexes(boolean hasRootIndexes) {
- lastNegativeIndexCheck = hasRootIndexes ? 0 :
System.currentTimeMillis();
+ static void setThreshold(int t) {
+ threshold = t;
}
-
- public static void setCacheTimeoutForTesting(long timeout) {
- noIndexCacheTimeout = timeout;
- }
-
- public static void resetCacheTimeoutForTesting() {
- noIndexCacheTimeout = DEFAULT_NO_INDEX_CACHE_TIMEOUT;
- }
-
}
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/package-info.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/package-info.java?rev=1720375&r1=1720374&r2=1720375&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/package-info.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/package-info.java
Wed Dec 16 15:35:28 2015
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@Version("2.0.0")
+@Version("3.0.0")
@Export(optional = "provide:=true")
package org.apache.jackrabbit.oak.plugins.index.property;
Added:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java?rev=1720375&view=auto
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
(added)
+++
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexEditorProviderTest.java
Wed Dec 16 15:35:28 2015
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.index.property;
+
+import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_CONTENT_NODE_NAME;
+import static
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
+import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
+import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexUtils;
+import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
+import org.apache.jackrabbit.oak.plugins.tree.TreeFactory;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
+import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
+import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.util.NodeUtil;
+import org.junit.Test;
+
+import ch.qos.logback.classic.Level;
+
+public class OrderedPropertyIndexEditorProviderTest {
+ private final CommitHook hook = new EditorHook(new IndexUpdateProvider(
+ new OrderedPropertyIndexEditorProvider()));
+ private final LogCustomizer custom = LogCustomizer
+
.forLogger(OrderedPropertyIndexEditorProvider.class.getName()).enable(Level.WARN).create();
+
+ private final String indexName = "mickey";
+ private final String indexedProperty = "mouse";
+
+ private void createIndexDef(NodeBuilder root) throws RepositoryException {
+ IndexUtils
+ .createIndexDefinition(
+ new NodeUtil(TreeFactory.createTree(root
+ .child(IndexConstants.INDEX_DEFINITIONS_NAME))), indexName,
false,
+ new String[] { indexedProperty }, null, OrderedIndex.TYPE);
+ }
+
+ @Test
+ public void withIndexDefSingleNode() throws RepositoryException,
CommitFailedException {
+ NodeBuilder root = InitialContent.INITIAL_CONTENT.builder();
+
+ createIndexDef(root);
+
+ NodeState before = root.getNodeState();
+ root.child("n1").setProperty(indexedProperty, "dead");
+ NodeState after = root.getNodeState();
+
+ custom.starting();
+ root = hook.processCommit(before, after, CommitInfo.EMPTY).builder();
+ assertEquals(1, custom.getLogs().size());
+ assertThat(custom.getLogs(),
hasItem(OrderedIndex.DEPRECATION_MESSAGE));
+ custom.finished();
+
+ NodeBuilder b =
root.getChildNode(IndexConstants.INDEX_DEFINITIONS_NODE_TYPE)
+
.getChildNode(indexName).getChildNode(IndexConstants.INDEX_CONTENT_NODE_NAME);
+ assertFalse("nothing should have been touched under the actual index",
b.exists());
+ }
+
+ @Test
+ public void withIndexMultipleNodes() throws RepositoryException,
CommitFailedException {
+ final int threshold = 5;
+ final int nodes = 16;
+ final int traces = nodes / threshold;
+ OrderedPropertyIndexEditorProvider.setThreshold(threshold);
+ final List<String> expected = Collections.nCopies(traces,
OrderedIndex.DEPRECATION_MESSAGE);
+ NodeBuilder root = InitialContent.INITIAL_CONTENT.builder();
+ createIndexDef(root);
+
+ custom.starting();
+ for (int i = 0; i < nodes; i++) {
+ NodeState before = root.getNodeState();
+ root.child("n" + i).setProperty(indexedProperty, "dead" + i);
+ NodeState after = root.getNodeState();
+ root = hook.processCommit(before, after,
CommitInfo.EMPTY).builder();
+ }
+
+ assertThat(custom.getLogs(), is(expected));
+ custom.finished();
+
assertFalse(root.getChildNode(INDEX_DEFINITIONS_NAME).getChildNode(indexName)
+ .getChildNode(INDEX_CONTENT_NODE_NAME).exists());
+ }
+}
Added:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProviderTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProviderTest.java?rev=1720375&view=auto
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProviderTest.java
(added)
+++
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexProviderTest.java
Wed Dec 16 15:35:28 2015
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.index.property;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.jackrabbit.oak.Oak;
+import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
+import
org.apache.jackrabbit.oak.plugins.index.reference.ReferenceIndexProvider;
+import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
+import org.apache.jackrabbit.oak.query.AbstractQueryTest;
+import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.junit.Test;
+
+import ch.qos.logback.classic.Level;
+
+public class OrderedPropertyIndexProviderTest extends AbstractQueryTest {
+ private final LogCustomizer custom = LogCustomizer
+
.forLogger(OrderedPropertyIndexProvider.class.getName()).enable(Level.WARN).create();
+
+ @Override
+ protected void createTestIndexNode() throws Exception {
+ // no index definitions OOTB
+ }
+
+ @Override
+ protected ContentRepository createRepository() {
+ return new Oak()
+ .with(new InitialContent())
+ .with(new OpenSecurityProvider())
+ .with(new ReferenceIndexProvider())
+ .with(new OrderedPropertyIndexProvider())
+ .createContentRepository();
+ }
+
+ @Test
+ public void singleQueryRun() {
+ custom.starting();
+ executeQuery("SELECT * FROM [oak:Unstructured]", SQL2);
+ List<String> logs = custom.getLogs();
+ assertEquals(1, logs.size());
+ assertThat(logs, hasItem(OrderedIndex.DEPRECATION_MESSAGE));
+ custom.finished();
+ }
+
+ @Test
+ public void multipleQueryRuns() {
+ final int executions = 16;
+ final int trackEvery = 5;
+ final int numTraces = executions / trackEvery;
+ OrderedPropertyIndexProvider.setThreshold(trackEvery);
+ List<String> expectedLogs = Collections.nCopies(numTraces,
OrderedIndex.DEPRECATION_MESSAGE);
+ custom.starting();
+ for (int i = 0; i < executions; i++) {
+ executeQuery("SELECT * FROM [oak:Unstructured]", SQL2);
+ }
+ assertThat(custom.getLogs(), is(expectedLogs));
+ custom.finished();
+ }
+}
Modified:
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java?rev=1720375&r1=1720374&r2=1720375&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
(original)
+++
jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
Wed Dec 16 15:35:28 2015
@@ -37,7 +37,6 @@ import org.apache.jackrabbit.oak.plugins
import
org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider;
import org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider;
import
org.apache.jackrabbit.oak.plugins.index.property.OrderedPropertyIndexEditorProvider;
-import
org.apache.jackrabbit.oak.plugins.index.property.OrderedPropertyIndexProvider;
import
org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider;
import
org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider;
@@ -127,7 +126,6 @@ public class Jcr {
with(new NodeCounterEditorProvider());
with(new PropertyIndexProvider());
- with(new OrderedPropertyIndexProvider());
with(new NodeTypeIndexProvider());
with(new OrderedPropertyIndexEditorProvider());
Modified:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java?rev=1720375&r1=1720374&r2=1720375&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
(original)
+++
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Wed Dec 16 15:35:28 2015
@@ -27,9 +27,7 @@ import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
-import java.sql.Timestamp;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;
@@ -58,9 +56,6 @@ import org.apache.jackrabbit.oak.commons
import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
import org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest;
import org.apache.jackrabbit.oak.jcr.NodeStoreFixture;
-import
org.apache.jackrabbit.oak.plugins.index.property.OrderedPropertyIndexProvider;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@@ -73,16 +68,6 @@ public class QueryTest extends AbstractR
super(fixture);
}
- @BeforeClass
- public static void disableCaching() {
- OrderedPropertyIndexProvider.setCacheTimeoutForTesting(0);
- }
-
- @AfterClass
- public static void enableCaching() {
- OrderedPropertyIndexProvider.resetCacheTimeoutForTesting();
- }
-
@Test
public void join() throws Exception {
Session session = getAdminSession();
@@ -208,77 +193,6 @@ public class QueryTest extends AbstractR
}
@Test
- public void orderBy() throws Exception {
- Session session = getAdminSession();
- Node root = session.getRootNode();
-
- // add an ordered index on "lastMod"
- Node index = root.getNode("oak:index").
- addNode("lastMod", "oak:QueryIndexDefinition");
- index.setProperty("reindex", true);
- // index.setProperty("async", "async");
- index.setProperty("type", "ordered");
- index.setProperty("propertyNames", new String[] { "lastMod" },
- PropertyType.NAME);
-
- // disable the nodetype index
- Node nodeTypeIndex = root.getNode("oak:index").getNode("nodetype");
- nodeTypeIndex.setProperty("declaringNodeTypes", new String[] {
- "nt:Folder"
- }, PropertyType.NAME);
- session.save();
-
- // add 10 nodes
- Node test = root.addNode("test");
- for (int i = 0; i < 10; i++) {
- Node n = test.addNode("test" + i, "oak:Unstructured");
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(Timestamp.valueOf("2000-01-01 10:00:00")
- .getTime() + 1000 * i);
- n.addNode("content").setProperty("lastMod", cal);
- }
-
- session.save();
-
- // run the query
- String query = "/jcr:root/test//*[@jcr:primaryType='oak:Unstructured']
" +
- "order by content/@lastMod descending";
- QueryResult r = session.getWorkspace().getQueryManager()
- .createQuery(query, "xpath").execute();
- NodeIterator it = r.getNodes();
- StringBuilder buff = new StringBuilder();
- while (it.hasNext()) {
- if (buff.length() > 0) {
- buff.append(", ");
- }
- buff.append(it.nextNode().getPath());
- }
- assertEquals("/test/test9, /test/test8, /test/test7, /test/test6,
/test/test5, /test/test4, /test/test3, /test/test2, /test/test1, /test/test0",
- buff.toString());
-
- RowIterator rit;
-
- r = session.getWorkspace().getQueryManager()
- .createQuery("explain " + query, "xpath").execute();
- rit = r.getRows();
- assertEquals("[nt:base] as [a] /* ordered order by lastMod ancestor 1
" +
- "where ([a].[jcr:primaryType] = 'oak:Unstructured') " +
- "and (isdescendantnode([a], [/test])) */",
rit.nextRow().getValue("plan").getString());
-
- query = "/jcr:root/test//*[@jcr:primaryType='oak:Unstructured' " +
- "and content/@lastMod > '2001-02-01']";
- r = session.getWorkspace().getQueryManager()
- .createQuery("explain " + query, "xpath").execute();
- rit = r.getRows();
- assertEquals("[nt:base] as [a] /* ordered lastMod > 2001-02-01 " +
- "where ([a].[jcr:primaryType] = 'oak:Unstructured') " +
- "and ([a].[content/lastMod] > '2001-02-01') " +
- "and (isdescendantnode([a], [/test])) */",
- rit.nextRow().getValue("plan").getString());
-
- }
-
- @Test
public void propertyIndexWithDeclaringNodeTypeAndRelativQuery() throws
RepositoryException {
Session session = getAdminSession();
RowIterator rit;