diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndex.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndex.java index 3c01242..bc4b86c 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndex.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndex.java @@ -35,6 +35,12 @@ import org.apache.jackrabbit.oak.spi.state.NodeState; */ class NodeTypeIndex implements QueryIndex, JcrConstants { + private double maxCountPenalty; + + public NodeTypeIndex(double maxCountPenalty) { + this.maxCountPenalty = maxCountPenalty; + } + @Override public double getCost(Filter filter, NodeState root) { // TODO don't call getCost for such queries @@ -51,7 +57,7 @@ class NodeTypeIndex implements QueryIndex, JcrConstants { // doesn't have a node type restriction return Double.POSITIVE_INFINITY; } - NodeTypeIndexLookup lookup = new NodeTypeIndexLookup(root); + NodeTypeIndexLookup lookup = new NodeTypeIndexLookup(root, maxCountPenalty); if (lookup.isIndexed(filter.getPath(), filter)) { return lookup.getCost(filter); } else { @@ -61,7 +67,7 @@ class NodeTypeIndex implements QueryIndex, JcrConstants { @Override public Cursor query(Filter filter, NodeState root) { - NodeTypeIndexLookup lookup = new NodeTypeIndexLookup(root); + NodeTypeIndexLookup lookup = new NodeTypeIndexLookup(root, maxCountPenalty); if (!hasNodeTypeRestriction(filter) || !lookup.isIndexed(filter.getPath(), filter)) { throw new IllegalStateException( "NodeType index is used even when no index is available for filter " + filter); diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java index e4a61bb..dc7fb0b 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexLookup.java @@ -33,8 +33,11 @@ class NodeTypeIndexLookup implements JcrConstants { private final NodeState root; - public NodeTypeIndexLookup(NodeState root) { + private double maxCountPenalty; + + public NodeTypeIndexLookup(NodeState root, double maxCountPenalty) { this.root = root; + this.maxCountPenalty = maxCountPenalty; } /** @@ -61,12 +64,12 @@ class NodeTypeIndexLookup implements JcrConstants { } NodeState child = root.getChildNode(path.substring(0, slash)); - return new NodeTypeIndexLookup(child).isIndexed( + return new NodeTypeIndexLookup(child, maxCountPenalty).isIndexed( path.substring(slash), f); } public double getCost(Filter filter) { - PropertyIndexLookup lookup = new PropertyIndexLookup(root); + PropertyIndexLookup lookup = new PropertyIndexLookup(root, maxCountPenalty); return lookup.getCost(filter, JCR_PRIMARYTYPE, newName(filter.getPrimaryTypes())) + lookup.getCost(filter, JCR_MIXINTYPES, newName(filter.getMixinTypes())); } diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexProvider.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexProvider.java index d61d1f0..7306d31 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexProvider.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexProvider.java @@ -19,11 +19,15 @@ package org.apache.jackrabbit.oak.plugins.index.nodetype; import java.util.List; +import java.util.Map; import javax.annotation.Nonnull; +import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; +import org.apache.jackrabbit.oak.commons.PropertiesUtil; import org.apache.jackrabbit.oak.spi.query.QueryIndex; import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider; import org.apache.jackrabbit.oak.spi.state.NodeState; @@ -34,13 +38,27 @@ import com.google.common.collect.ImmutableList; * NodeTypeIndexProvider is a {@link QueryIndexProvider} for * {@link NodeTypeIndex} instances. */ -@Component +@Component(metatype = true, label = "Apache Jackrabbit Oak NodeType Index Provider", + description = "Apache Jackrabbit Oak NodeType Index Provider") @Service(QueryIndexProvider.class) public class NodeTypeIndexProvider implements QueryIndexProvider { + static final double DEFAULT_MAX_COUNT_PENALTY = 1.6; + + @Property(label = "Max Count Penalty", doubleValue = DEFAULT_MAX_COUNT_PENALTY, + description = "Penalty factor for exceeding maximum node count while counting index content") + private static final String PROP_MAX_COUNT_PENALTY = "max.penalty"; + + private double maxCountPenalty = DEFAULT_MAX_COUNT_PENALTY; + + @Activate + protected void activate(Map properties) { + this.maxCountPenalty = PropertiesUtil.toDouble(properties.get(PROP_MAX_COUNT_PENALTY), DEFAULT_MAX_COUNT_PENALTY); + } + @Nonnull @Override public List getQueryIndexes(NodeState nodeState) { - return ImmutableList.of(new NodeTypeIndex()); + return ImmutableList.of(new NodeTypeIndex(maxCountPenalty)); } } diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexLookup.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexLookup.java index b091da3..c7e24ea 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexLookup.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/OrderedPropertyIndexLookup.java @@ -78,7 +78,7 @@ public class OrderedPropertyIndexLookup extends PropertyIndexLookup { if (indexMeta != null) { // we relay then on the standard property index for the cost cost = COST_OVERHEAD - + getStrategy(indexMeta).count(indexMeta, PropertyIndex.encode(value), MAX_COST); + + getStrategy(indexMeta).count(indexMeta, PropertyIndex.encode(value), MAX_COST, getMaxCountPenalty()); } return cost; } @@ -113,6 +113,6 @@ public class OrderedPropertyIndexLookup extends PropertyIndexLookup { PropertyRestriction pr) { NodeState indexMeta = getIndexNode(root, propertyName, filter); OrderedContentMirrorStoreStrategy strategy = (OrderedContentMirrorStoreStrategy) getStrategy(indexMeta); - return strategy.count(indexMeta, pr, MAX_COST); + return strategy.count(indexMeta, pr, MAX_COST, getMaxCountPenalty()); } } \ No newline at end of file diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java index 7409562..b3d36ab 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexEditor.java @@ -276,7 +276,7 @@ class PropertyIndexEditor implements IndexEditor { NodeState indexMeta = definition.getNodeState(); IndexStoreStrategy s = getStrategy(true); for (String key : keysToCheckForUniqueness) { - if (s.count(indexMeta, singleton(key), 2) > 1) { + if (s.count(indexMeta, singleton(key), 2, PropertyIndexLookup.DEFAULT_MAX_COUNT_PENALTY) > 1) { throw new CommitFailedException( CONSTRAINT, 30, "Uniqueness constraint violated for key " + key); diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java index ae18d9b..afc9d76 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexLookup.java @@ -69,6 +69,8 @@ public class PropertyIndexLookup { */ static final int MAX_COST = 100; + static final double DEFAULT_MAX_COUNT_PENALTY = 1.1; + /** Index storage strategy */ private static final IndexStoreStrategy MIRROR = new ContentMirrorStoreStrategy(); @@ -79,8 +81,15 @@ public class PropertyIndexLookup { private final NodeState root; + private final double maxCountPenalty; + public PropertyIndexLookup(NodeState root) { + this(root, DEFAULT_MAX_COUNT_PENALTY); + } + + public PropertyIndexLookup(NodeState root, double maxCountPenalty) { this.root = root; + this.maxCountPenalty = maxCountPenalty; } /** @@ -129,7 +138,7 @@ public class PropertyIndexLookup { return Double.POSITIVE_INFINITY; } return COST_OVERHEAD + - getStrategy(indexMeta).count(indexMeta, encode(value), MAX_COST); + getStrategy(indexMeta).count(indexMeta, encode(value), MAX_COST, maxCountPenalty); } /** @@ -191,6 +200,10 @@ public class PropertyIndexLookup { return TYPE; } + double getMaxCountPenalty() { + return maxCountPenalty; + } + private static Set getSuperTypes(Filter filter) { if (filter != null && !filter.matchesAllTypes()) { return filter.getSupertypes(); diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java index 2ddd097..f335521 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategy.java @@ -152,12 +152,12 @@ public class ContentMirrorStoreStrategy implements IndexStoreStrategy { } @Override - public long count(NodeState indexMeta, Set values, int max) { - return count(indexMeta, INDEX_CONTENT_NODE_NAME, values, max); + public long count(NodeState indexMeta, Set values, int max, double maxCountPenalty) { + return count(indexMeta, INDEX_CONTENT_NODE_NAME, values, max, maxCountPenalty); } public long count(NodeState indexMeta, final String indexStorageNodeName, - Set values, int max) { + Set values, int max, double maxCountPenalty) { NodeState index = indexMeta.getChildNode(indexStorageNodeName); int count = 0; if (values == null) { @@ -165,7 +165,7 @@ public class ContentMirrorStoreStrategy implements IndexStoreStrategy { if (ec != null) { return ec.getValue(Type.LONG); } - CountingNodeVisitor v = new CountingNodeVisitor(max); + CountingNodeVisitor v = new CountingNodeVisitor(max, maxCountPenalty); v.visit(index); count = v.getEstimatedCount(); // "is not null" queries typically read more data @@ -186,7 +186,7 @@ public class ContentMirrorStoreStrategy implements IndexStoreStrategy { } NodeState s = index.getChildNode(p); if (s.exists()) { - CountingNodeVisitor v = new CountingNodeVisitor(max); + CountingNodeVisitor v = new CountingNodeVisitor(max, maxCountPenalty); v.visit(s); count += v.getEstimatedCount(); } @@ -357,8 +357,15 @@ public class ContentMirrorStoreStrategy implements IndexStoreStrategy { */ long depthTotal; - CountingNodeVisitor(int maxCount) { + /** + * A factor by which the estimated cost should be increased + * should the max code should be reached; + */ + double maxCountPenalty; + + CountingNodeVisitor(int maxCount, double maxCountPenalty) { this.maxCount = maxCount; + this.maxCountPenalty = maxCountPenalty; } @Override @@ -403,7 +410,7 @@ public class ContentMirrorStoreStrategy implements IndexStoreStrategy { double averageDepth = (int) (depthTotal / count); // the number of estimated matches is higher // the higher the average depth of the first hits - long estimatedNodes = (long) (count * Math.pow(1.1, averageDepth)); + long estimatedNodes = (long) (count * Math.pow(maxCountPenalty, averageDepth)); estimatedNodes = Math.min(estimatedNodes, Integer.MAX_VALUE); return Math.max(count, (int) estimatedNodes); } diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/IndexStoreStrategy.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/IndexStoreStrategy.java index 5864eef..a72688d 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/IndexStoreStrategy.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/IndexStoreStrategy.java @@ -58,8 +58,9 @@ public interface IndexStoreStrategy { * @param indexMeta the index metadata node (may not be null) * @param values values to look for (null to check for property existence) * @param max the maximum value to return + * @param maxCountPenalty the penalty factor for exceeding the max value * @return the aggregated count of occurrences for each provided value */ - long count(NodeState indexMeta, Set values, int max); + long count(NodeState indexMeta, Set values, int max, double maxCountPenalty); } diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java index 3f78b78..db729fe 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStoreStrategy.java @@ -367,9 +367,10 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg * @param indexMeta * @param pr * @param max + * @param maxCountPenalty * @return the estimated number of nodes */ - public long count(NodeState indexMeta, Filter.PropertyRestriction pr, int max) { + public long count(NodeState indexMeta, Filter.PropertyRestriction pr, int max, double maxCountPenalty) { long count = 0; NodeState content = indexMeta.getChildNode(INDEX_CONTENT_NODE_NAME); Filter.PropertyRestriction lpr = pr; @@ -387,7 +388,7 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg value = lpr.first.getValue(Type.STRING); NodeState n = content.getChildNode(value); if (n.exists()) { - CountingNodeVisitor v = new CountingNodeVisitor(max); + CountingNodeVisitor v = new CountingNodeVisitor(max, maxCountPenalty); v.visit(n); count = v.getEstimatedCount(); } @@ -397,7 +398,7 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg if (ec != null) { count = ec.getValue(Type.LONG); } else { - CountingNodeVisitor v = new CountingNodeVisitor(max); + CountingNodeVisitor v = new CountingNodeVisitor(max, maxCountPenalty); v.visit(content); count = v.getEstimatedCount(); } @@ -442,7 +443,7 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg String converted = convert(child.getName()); if (predicate.apply(converted)) { // here we are let's start counting - v = new CountingNodeVisitor(max); + v = new CountingNodeVisitor(max, maxCountPenalty); v.visit(content.getChildNode(child.getName())); count += v.getCount(); depthTotal += v.depthTotal; @@ -452,7 +453,7 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg } } // small hack for having a common way of counting - v = new CountingNodeVisitor(max); + v = new CountingNodeVisitor(max, maxCountPenalty); v.depthTotal = depthTotal; v.count = (int) Math.min(count, Integer.MAX_VALUE); count = v.getEstimatedCount(); @@ -497,7 +498,7 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg String converted = convert(child.getName()); if (predicate.apply(converted)) { // here we are let's start counting - v = new CountingNodeVisitor(max); + v = new CountingNodeVisitor(max, maxCountPenalty); v.visit(content.getChildNode(child.getName())); count += v.getCount(); depthTotal += v.depthTotal; @@ -507,7 +508,7 @@ public class OrderedContentMirrorStoreStrategy extends ContentMirrorStoreStrateg } } // small hack for having a common way of counting - v = new CountingNodeVisitor(max); + v = new CountingNodeVisitor(max, maxCountPenalty); v.depthTotal = depthTotal; v.count = (int) Math.min(count, Integer.MAX_VALUE); count = v.getEstimatedCount(); diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategy.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategy.java index 15111ec..8156315 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategy.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/UniqueEntryStoreStrategy.java @@ -142,7 +142,7 @@ public class UniqueEntryStoreStrategy implements IndexStoreStrategy { } @Override - public long count(NodeState indexMeta, Set values, int max) { + public long count(NodeState indexMeta, Set values, int max, double maxCountPenalty) { NodeState index = indexMeta.getChildNode(INDEX_CONTENT_NODE_NAME); long count = 0; if (values == null) { diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java index 289b7e5..dcc4700 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java @@ -348,7 +348,7 @@ class ReferenceEditor extends DefaultEditor implements IndexEditor { private static boolean check(NodeState definition, String name, String key) { return definition.hasChildNode(name) - && STORE.count(definition, name, of(key), 1) > 0; + && STORE.count(definition, name, of(key), 1, 1) > 0; } } diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java index 751590a..0dc3928 100644 --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/nodetype/NodeTypeIndexTest.java @@ -81,7 +81,7 @@ public class NodeTypeIndexTest { new PropertyIndexEditorProvider())), CommitInfo.EMPTY); NodeState rootState = store.getRoot(); - NodeTypeIndex index = new NodeTypeIndex(); + NodeTypeIndex index = new NodeTypeIndex(NodeTypeIndexProvider.DEFAULT_MAX_COUNT_PENALTY); FilterImpl filter; filter = createFilter(rootState, JcrConstants.NT_FOLDER); diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java index fba22b3..9d5bb29 100644 --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/ContentMirrorStoreStrategyTest.java @@ -137,7 +137,7 @@ public class ContentMirrorStoreStrategyTest { store.update(index, "b", EMPTY, KEY); Assert.assertTrue( "ContentMirrorStoreStrategy should guarantee uniqueness on insert", - store.count(indexMeta.getNodeState(), Collections.singleton("key"), 2) > 1); + store.count(indexMeta.getNodeState(), Collections.singleton("key"), 2, 1) > 1); } } diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java index 0390635..405c2e1 100644 --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/strategy/OrderedContentMirrorStorageStrategyTest.java @@ -1266,6 +1266,7 @@ public class OrderedContentMirrorStorageStrategyTest { final String testDescendingName = "testdescending"; final int numberOfNodes = 1000; final int maxNodeCount = 100; + final double maxPenalty = 1.1; NodeBuilder builder = EmptyNodeState.EMPTY_NODE.builder(); @@ -1306,8 +1307,8 @@ public class OrderedContentMirrorStorageStrategyTest { pr.last = PropertyValues.newString(value); pr.firstIncluding = true; pr.lastIncluding = true; - assertEquals(1, store.count(ascendingMeta, pr, maxNodeCount)); - assertEquals(1, descendingStore.count(descendingMeta, pr, maxNodeCount)); + assertEquals(1, store.count(ascendingMeta, pr, maxNodeCount, maxPenalty)); + assertEquals(1, descendingStore.count(descendingMeta, pr, maxNodeCount, maxPenalty)); // property not null pr = new Filter.PropertyRestriction(); @@ -1317,9 +1318,9 @@ public class OrderedContentMirrorStorageStrategyTest { pr.lastIncluding = false; // don't care about the actual results as long as we have something. We're reusing existing // code - assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0); - assertEquals(store.count(ascendingMeta, pr, maxNodeCount), - descendingStore.count(descendingMeta, pr, maxNodeCount)); + assertTrue(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); + assertEquals(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty), + descendingStore.count(descendingMeta, pr, maxNodeCount, maxPenalty)); // '>' pr = new Filter.PropertyRestriction(); @@ -1329,8 +1330,8 @@ public class OrderedContentMirrorStorageStrategyTest { pr.lastIncluding = false; // don't care about the actual results as long as we have something. We're reusing existing // code - assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0); - assertTrue(descendingStore.count(ascendingMeta, pr, maxNodeCount) > 0); + assertTrue(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); + assertTrue(descendingStore.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); // '>=' pr = new Filter.PropertyRestriction(); @@ -1340,8 +1341,8 @@ public class OrderedContentMirrorStorageStrategyTest { pr.lastIncluding = false; // don't care about the actual results as long as we have something. We're reusing existing // code - assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0); - assertTrue(descendingStore.count(ascendingMeta, pr, maxNodeCount) > 0); + assertTrue(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); + assertTrue(descendingStore.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); // '<' pr = new Filter.PropertyRestriction(); @@ -1351,14 +1352,14 @@ public class OrderedContentMirrorStorageStrategyTest { pr.lastIncluding = false; // don't care about the actual results as long as we have something. We're reusing existing // code - assertTrue(descendingStore.count(descendingMeta, pr, maxNodeCount) > 0); - assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0); + assertTrue(descendingStore.count(descendingMeta, pr, maxNodeCount, maxPenalty) > 0); + assertTrue(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); // when no conditions has been asked but just an ORDER BY pr = null; - assertTrue(store.count(ascendingMeta, pr, maxNodeCount) > 0); - assertEquals(store.count(ascendingMeta, pr, maxNodeCount), - descendingStore.count(descendingMeta, pr, maxNodeCount)); + assertTrue(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty) > 0); + assertEquals(store.count(ascendingMeta, pr, maxNodeCount, maxPenalty), + descendingStore.count(descendingMeta, pr, maxNodeCount, maxPenalty)); } @Test