use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class TraverseWithSortStrategy method writeToSortedFiles.
private void writeToSortedFiles() throws IOException {
Stopwatch w = Stopwatch.createStarted();
for (NodeStateEntry e : nodeStates) {
entryCount++;
addEntry(e);
}
// Save the last batch
sortAndSaveBatch();
// Free up the batch
entryBatch.clear();
entryBatch.trimToSize();
log.info("Dumped {} nodestates in json format in {}", entryCount, w);
log.info("Created {} sorted files of size {} to merge", sortedFiles.size(), humanReadableByteCount(sizeOf(sortedFiles)));
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class FlatFileStoreIteratorTest method comodificationException.
// OAK-7284
@Test
public void comodificationException() {
Set<String> preferred = ImmutableSet.of("j:c");
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/j:c", "/a/j:c/j:c", "/a/b"));
FlatFileStoreIterator fitr = new FlatFileStoreIterator(citr.iterator(), preferred);
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
NodeState aNS = a.getNodeState();
// fake aggregate rule like "j:c/*"
for (ChildNodeEntry cne : aNS.getChildNodeEntries()) {
NodeState childNS = cne.getNodeState();
// read preferred names for aggregation sub-tree nodes
for (String prefName : preferred) {
childNS.getChildNode(prefName);
}
}
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class FlatFileStoreIteratorTest method invalidOrderAccess.
@Test
public void invalidOrderAccess() {
Set<String> preferred = ImmutableSet.of("jcr:content");
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/jcr:content/metadata", "/a/d", "/e"));
FlatFileStoreIterator fitr = new FlatFileStoreIterator(citr.iterator(), preferred);
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
NodeState ns1 = a.getNodeState().getChildNode("jcr:content");
NodeStateEntry nse1 = fitr.next();
assertEquals("/a/jcr:content", nse1.getPath());
assertEquals(1, nse1.getNodeState().getChildNodeCount(100));
// Now move past /a/jcr:content
NodeStateEntry nse2 = fitr.next();
assertEquals("/a/jcr:content/metadata", nse2.getPath());
try {
// Now access from /a/jcr:content node should fail
ns1.getChildNodeCount(100);
fail("Access should have failed");
} catch (IllegalStateException ignore) {
}
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class FlatFileStoreIteratorTest method getChildNodeLimitedByNonPreferred.
// OAK-7285
@Test
public void getChildNodeLimitedByNonPreferred() {
// have more than 1 preferred names
Set<String> preferred = ImmutableSet.of("j:c", "md");
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/b", "/a/c"));
FlatFileStoreIterator fitr = new FlatFileStoreIterator(citr.iterator(), preferred);
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
NodeState aNS = a.getNodeState();
aNS.getChildNode("j:c");
// Don't read whole tree to conclude that "j:c" doesn't exist (reading /a/b should imply that it doesn't exist)
assertEquals(1, fitr.getBufferSize());
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class FlatFileStoreIteratorTest method simpleTraversal.
@Test
public void simpleTraversal() {
Set<String> preferred = ImmutableSet.of("jcr:content");
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/jcr:content/metadata", "/a/d", "/e"));
FlatFileStoreIterator fitr = new FlatFileStoreIterator(citr.iterator(), preferred);
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
NodeState ns1 = a.getNodeState().getChildNode("jcr:content");
assertEquals("/a/jcr:content", ns1.getString("path"));
assertEquals(1, fitr.getBufferSize());
NodeState ns2 = ns1.getChildNode("metadata");
assertEquals("/a/jcr:content/metadata", ns2.getString("path"));
assertEquals(2, fitr.getBufferSize());
NodeStateEntry nse1 = fitr.next();
assertEquals("/a/jcr:content", nse1.getPath());
NodeStateEntry nse2 = fitr.next();
assertEquals("/a/jcr:content/metadata", nse2.getPath());
NodeStateEntry nse3 = fitr.next();
assertEquals("/a/d", nse3.getPath());
assertEquals(0, nse3.getNodeState().getChildNodeCount(100));
NodeStateEntry nse4 = fitr.next();
assertEquals("/e", nse4.getPath());
assertEquals(0, nse4.getNodeState().getChildNodeCount(100));
assertFalse(fitr.hasNext());
}
Aggregations