### Eclipse Workspace Patch 1.0 #P oak-jcr-1.0 Index: src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java =================================================================== --- src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java (revision 1630050) +++ src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java (working copy) @@ -80,21 +80,21 @@ @Parameterized.Parameters public static Collection fixtures() { Collection result = new ArrayList(); - if (FIXTURES.isEmpty() || FIXTURES.contains("MK_IMPL")) { - result.add(new Object[] { NodeStoreFixture.MK_IMPL }); - } - if (FIXTURES.isEmpty() || FIXTURES.contains("DOCUMENT_MK")) { - result.add(new Object[] { NodeStoreFixture.DOCUMENT_MK }); - } - if (FIXTURES.isEmpty() || FIXTURES.contains("DOCUMENT_NS")) { - result.add(new Object[] { NodeStoreFixture.DOCUMENT_NS }); - } +// if (FIXTURES.isEmpty() || FIXTURES.contains("MK_IMPL")) { +// result.add(new Object[] { NodeStoreFixture.MK_IMPL }); +// } +// if (FIXTURES.isEmpty() || FIXTURES.contains("DOCUMENT_MK")) { +// result.add(new Object[] { NodeStoreFixture.DOCUMENT_MK }); +// } +// if (FIXTURES.isEmpty() || FIXTURES.contains("DOCUMENT_NS")) { +// result.add(new Object[] { NodeStoreFixture.DOCUMENT_NS }); +// } if (FIXTURES.isEmpty() || FIXTURES.contains("SEGMENT_MK")) { result.add(new Object[] { NodeStoreFixture.SEGMENT_MK }); } - if (FIXTURES.isEmpty() || FIXTURES.contains("DOCUMENT_JDBC")) { - result.add(new Object[] { NodeStoreFixture.DOCUMENT_JDBC }); - } +// if (FIXTURES.isEmpty() || FIXTURES.contains("DOCUMENT_JDBC")) { +// result.add(new Object[] { NodeStoreFixture.DOCUMENT_JDBC }); +// } return result; } Index: src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java =================================================================== --- src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java (revision 1630050) +++ src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java (working copy) @@ -35,6 +35,7 @@ import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection; import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore; import org.apache.jackrabbit.oak.plugins.segment.SegmentStore; +import org.apache.jackrabbit.oak.plugins.segment.file.FileStore; import org.apache.jackrabbit.oak.plugins.segment.memory.MemoryStore; import org.apache.jackrabbit.oak.spi.blob.BlobStore; import org.apache.jackrabbit.oak.spi.state.NodeStore; @@ -43,8 +44,21 @@ * NodeStore fixture for parametrized tests. */ public abstract class NodeStoreFixture { + + public static final NodeStoreFixture SEGMENT_MK; - public static final NodeStoreFixture SEGMENT_MK = new SegmentFixture(); + static { + File file = new File(new File("target"), "tar." + System.nanoTime()); + NodeStoreFixture sf = null; + try { + SegmentStore segmentStore = new FileStore(file, 266, true); + sf = new SegmentFixture(segmentStore); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + SEGMENT_MK =sf; + } public static final NodeStoreFixture DOCUMENT_MK = new NodeStoreFixture() { @Override Index: src/test/java/org/apache/jackrabbit/oak/jcr/query/OrderedIndexCreateTest.java =================================================================== --- src/test/java/org/apache/jackrabbit/oak/jcr/query/OrderedIndexCreateTest.java (revision 0) +++ src/test/java/org/apache/jackrabbit/oak/jcr/query/OrderedIndexCreateTest.java (working copy) @@ -0,0 +1,124 @@ +/* + * 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.jcr.query; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Calendar; +import java.util.Date; + +import javax.jcr.Node; +import javax.jcr.PropertyType; +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.query.Query; +import javax.jcr.query.QueryManager; +import javax.jcr.query.QueryResult; +import javax.jcr.query.RowIterator; + +import org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest; +import org.apache.jackrabbit.oak.jcr.NodeStoreFixture; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Tests query plans. + */ +public class OrderedIndexCreateTest extends AbstractRepositoryTest { + + static { + // 7159 12423 40 with 3 lanes, 1 prob + // 7363 5397 40 with 4 lanes, 1 prob + // 6929 4498 40 with 5 lanes, 1 prob + // 6929 4498 40 with 6 lanes, 1 prob + // 6960 4380 40 with prob 5 + // 6954 4219 40 with default (3) + // 7019 4724 40 with prob 1 + // 7019 4724 40 with prob 1 + + +// System.setProperty("oak.orderedIndex.lanes", "4"); + System.setProperty("oak.orderedIndex.prob", "4"); + + // defaults / ascending +// 125000 nodes created in ms: 9956 +// create index: 8256 + + // new defaults / descending +// 125000 nodes created in ms: 10424 +// create index: 8827 + + // new defaults / descending +// 1000000 nodes created in ms: 65904 +// create index: 213133 + + // 1 prob / descending +// 1000000 nodes created in ms: 66425 +// create index: 232756 + + // 4 lanes / 1 prob / descending +// 1000000 nodes created in ms: 67331 +// create index: 530356 + } + + public OrderedIndexCreateTest(NodeStoreFixture fixture) { + super(fixture); + } + + @Test + public void createOrderedIndex() throws Exception { + Session session = getAdminSession(); + Node indexNode = session.getRootNode().getNode("oak:index"); + indexNode.getNode("nodetype").remove(); + session.save(); + long time = System.currentTimeMillis(); + Node test = session.getRootNode().addNode("test"); + int i = 0; + Calendar cal =Calendar.getInstance(); + int size = 100; + System.out.println(size * size * size); + for(int a=0; a