Author: mreutegg
Date: Wed Apr 10 11:13:19 2019
New Revision: 1857240
URL: http://svn.apache.org/viewvc?rev=1857240&view=rev
Log:
OAK-8141: Replace String path with custom data type
Added:
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactoryTest.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NamePathRev.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Path.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/DataTypeUtil.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCacheKeyTest.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/PathTest.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/StringCachePerformance.java
(with props)
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/DataTypeUtilTest.java
(with props)
Modified:
jackrabbit/oak/trunk/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/PersistentCacheTest.java
jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreHelper.java
jackrabbit/oak/trunk/oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/SweepHelper.java
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactory.java
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/DocumentTraverserTest.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentNodeState.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/BlobCollector.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Collision.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilder.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentBranchRootNodeState.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ExternalChange.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalDiffLoader.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/JournalEntry.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevTracker.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/MissingLastRevSeeker.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweepListener.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeper.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PathComparator.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PathRev.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/PropertyHistory.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ResetDiff.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/SplitDocumentCleanUp.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/SplitOperations.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/StringCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnmergedBranches.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDiffer.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/locks/StripedNodeDocumentLocks.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/CacheType.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/KeyDataType.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/NodeCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/ValueDataType.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/DelegatingDocumentNodeState.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/PathFilteringDiff.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/RevisionsKey.java
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AsyncCacheTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BranchTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyRDBTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilderTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitRootUpdateTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdate2IT.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdateIT.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranchesTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepIT.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MemoryDiffCacheTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeDocumentSweeperTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/PathComparatorTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/PathRevTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/SimpleTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ValueMapTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCDeletionTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandlerTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/cache/CacheChangesTrackerTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDBExceptionTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeekerTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/QueryHintTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/RetryReadIT.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/AsyncQueueTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/BroadcastTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/CacheTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/persistentCache/NodeCacheTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCacheTest.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java
jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/nodestate/MetadataExposingNodeState.java
Modified:
jackrabbit/oak/trunk/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/PersistentCacheTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/PersistentCacheTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/PersistentCacheTest.java
(original)
+++
jackrabbit/oak/trunk/oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/PersistentCacheTest.java
Wed Apr 10 11:13:19 2019
@@ -26,8 +26,10 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBuilder;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreHelper;
+import org.apache.jackrabbit.oak.plugins.document.Path;
import org.apache.jackrabbit.oak.plugins.document.PathRev;
import org.apache.jackrabbit.oak.plugins.document.Revision;
+import org.apache.jackrabbit.oak.plugins.document.RevisionVector;
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
import javax.jcr.Repository;
@@ -73,7 +75,9 @@ public class PersistentCacheTest extends
@Override
protected void runTest() throws Exception {
for (int i = 0; i < ITEMS_TO_ADD; i++) {
- PathRev key = PathRev.fromString("/" + timestamp.getAndIncrement()
+ "@" + new Revision(timestamp.getAndIncrement(), 0, 0));
+ Path p = Path.fromString("/" + timestamp.getAndIncrement());
+ Revision r = new Revision(timestamp.getAndIncrement(), 0, 0);
+ PathRev key = new PathRev(p, new RevisionVector(r));
nodesCache.put(key, dns.getRoot());
nodesCache.getIfPresent(key); // read, so the entry is marked as
used
}
Modified:
jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreHelper.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreHelper.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreHelper.java
(original)
+++
jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreHelper.java
Wed Apr 10 11:13:19 2019
@@ -194,13 +194,13 @@ public class DocumentNodeStoreHelper {
private static class BlobReferences {
- final String path;
+ final Path path;
final long blobSize;
final long garbageSize;
final int numBlobs;
final boolean exists;
- public BlobReferences(String path,
+ public BlobReferences(Path path,
long blobSize,
int numBlobs,
long garbageSize,
Modified:
jackrabbit/oak/trunk/oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy
(original)
+++
jackrabbit/oak/trunk/oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy
Wed Apr 10 11:13:19 2019
@@ -22,6 +22,7 @@ import groovy.transform.CompileStatic
import org.apache.jackrabbit.oak.console.ConsoleSession
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore
import org.apache.jackrabbit.oak.plugins.document.NodeDocument
+import org.apache.jackrabbit.oak.plugins.document.Path
import org.apache.jackrabbit.oak.plugins.document.util.Utils
import org.codehaus.groovy.tools.shell.CommandSupport
import org.codehaus.groovy.tools.shell.Groovysh
@@ -40,7 +41,7 @@ class LsdDocumentCommand extends Command
Object execute(List<String> args) {
assert session.store instanceof DocumentNodeStore
PrintWriter writer = io.out
- String path = session.getWorkingPath();
+ Path path = Path.fromString(session.getWorkingPath());
String fromKey = Utils.getKeyLowerLimit(path);
String toKey = Utils.getKeyUpperLimit(path);
int num = 0;
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
(original)
+++
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/NodeStateEntryTraverser.java
Wed Apr 10 11:13:19 2019
@@ -31,6 +31,7 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeState;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
+import org.apache.jackrabbit.oak.plugins.document.Path;
import org.apache.jackrabbit.oak.plugins.document.RevisionVector;
import org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore;
import org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentTraverser;
@@ -94,14 +95,15 @@ public class NodeStateEntryTraverser imp
}
private boolean includeDoc(NodeDocument doc) {
+ String path = doc.getPath().toString();
return !doc.isSplitDocument()
- && !NodeStateUtils.isHiddenPath(doc.getPath())
- && pathPredicate.test(doc.getPath());
+ && !NodeStateUtils.isHiddenPath(path)
+ && pathPredicate.test(path);
}
@SuppressWarnings("StaticPseudoFunctionalStyleMethod")
private Iterable<NodeStateEntry> getEntries(NodeDocument doc) {
- String path = doc.getPath();
+ Path path = doc.getPath();
DocumentNodeState nodeState = documentNodeStore.getNode(path,
rootRevision);
@@ -113,7 +115,7 @@ public class NodeStateEntryTraverser imp
return transform(
concat(singleton(nodeState),
nodeState.getAllBundledNodesStates()),
- dns -> new NodeStateEntry(dns, dns.getPath())
+ dns -> new NodeStateEntry(dns, dns.getPath().toString())
);
}
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/SweepHelper.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/SweepHelper.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/SweepHelper.java
(original)
+++
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/SweepHelper.java
Wed Apr 10 11:13:19 2019
@@ -62,7 +62,7 @@ public final class SweepHelper {
sweeper.sweep(seeker.getCandidates(sweepRev.get().getTimestamp()),
new NodeDocumentSweepListener() {
@Override
- public void sweepUpdate(Map<String, UpdateOp> updates)
+ public void sweepUpdate(Map<Path, UpdateOp> updates)
throws DocumentStoreException {
// create an invalidate entry
JournalEntry inv = JOURNAL.newDocument(store);
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactory.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactory.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactory.java
(original)
+++
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactory.java
Wed Apr 10 11:13:19 2019
@@ -20,9 +20,13 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
+import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.jackrabbit.oak.plugins.document.Path;
+import org.apache.jackrabbit.oak.plugins.document.PathComparator;
import org.apache.jackrabbit.oak.plugins.document.Revision;
+import org.mapdb.BTreeKeySerializer;
import org.mapdb.BTreeMap;
import org.mapdb.DB;
import org.mapdb.DBMaker;
@@ -46,11 +50,41 @@ public class MapDBMapFactory extends Map
}
@Override
- public BTreeMap<String, Revision> create() {
+ public BTreeMap<Path, Revision> create() {
return db.createTreeMap(String.valueOf(counter.incrementAndGet()))
+ .keySerializer(new PathSerializer())
.valueSerializer(new RevisionSerializer())
.counterEnable()
- .makeStringMap();
+ .make();
+ }
+
+ private static class PathSerializer
+ extends BTreeKeySerializer<Path>
+ implements Serializable {
+
+ @Override
+ public void serialize(DataOutput out, int start, int end, Object[]
keys)
+ throws IOException {
+ for (int i = start; i < end; i++) {
+ String p = keys[i].toString();
+ out.writeUTF(p);
+ }
+ }
+
+ @Override
+ public Object[] deserialize(DataInput in, int start, int end, int size)
+ throws IOException {
+ Object[] keys = new Object[size];
+ for (int i = start; i < end; i++) {
+ keys[i] = Path.fromString(in.readUTF());
+ }
+ return keys;
+ }
+
+ @Override
+ public Comparator<Path> getComparator() {
+ return PathComparator.INSTANCE;
+ }
}
private static class RevisionSerializer implements Serializer<Revision>,
Modified:
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/DocumentTraverserTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/DocumentTraverserTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/DocumentTraverserTest.java
(original)
+++
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/DocumentTraverserTest.java
Wed Apr 10 11:13:19 2019
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.plugins.document.Collection;
import org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
+import org.apache.jackrabbit.oak.plugins.document.Path;
import org.apache.jackrabbit.oak.plugins.document.UpdateOp;
import org.apache.jackrabbit.oak.plugins.document.util.CloseableIterable;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
@@ -62,6 +63,7 @@ public class DocumentTraverserTest exten
CloseableIterable<NodeDocument> itr =
traverser.getAllDocuments(Collection.NODES, id ->
getPathFromId(id).startsWith("/a"));
Set<String> paths = StreamSupport.stream(itr.spliterator(), false)
.map(NodeDocument::getPath)
+ .map(Path::toString)
.collect(Collectors.toSet());
itr.close();
Added:
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactoryTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactoryTest.java?rev=1857240&view=auto
==============================================================================
---
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactoryTest.java
(added)
+++
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactoryTest.java
Wed Apr 10 11:13:19 2019
@@ -0,0 +1,42 @@
+/*
+ * 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.document.util;
+
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.jackrabbit.oak.plugins.document.Path;
+import org.apache.jackrabbit.oak.plugins.document.Revision;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class MapDBMapFactoryTest {
+
+ @Test
+ public void mapDB() {
+ ConcurrentMap<Path, Revision> map = new MapDBMapFactory().create();
+ for (int i = 0; i < 10000; i++) {
+ map.put(Path.fromString("/some/test/path/node-" + i), new
Revision(i, 0, 1));
+ }
+ for (int i = 0; i < 10000; i++) {
+ assertEquals(
+ new Revision(i, 0, 1),
+ map.get(Path.fromString("/some/test/path/node-" + i))
+ );
+ }
+ }
+}
Propchange:
jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/MapDBMapFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentNodeState.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentNodeState.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentNodeState.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentNodeState.java
Wed Apr 10 11:13:19 2019
@@ -36,7 +36,7 @@ public abstract class AbstractDocumentNo
LoggerFactory.getLogger(AbstractDocumentNodeState.class.getName()
+ ".perf"));
- public abstract String getPath();
+ public abstract Path getPath();
public abstract RevisionVector getLastRevision();
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/BlobCollector.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/BlobCollector.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/BlobCollector.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/BlobCollector.java
Wed Apr 10 11:13:19 2019
@@ -45,7 +45,7 @@ public class BlobCollector {
Map<Revision, String> valueMap = doc.getLocalMap(key);
for (String v : valueMap.values()) {
if (v != null) {
- loadValue(v, blobs, doc.getPath());
+ loadValue(v, blobs, doc.getPath().toString());
}
}
}
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Branch.java
Wed Apr 10 11:13:19 2019
@@ -232,7 +232,7 @@ class Branch {
* there is none in this branch.
*/
@Nullable
- public Revision getUnsavedLastRevision(String path,
+ public Revision getUnsavedLastRevision(Path path,
Revision readRevision) {
readRevision = readRevision.asBranchRevision();
for (Revision r : commits.descendingKeySet()) {
@@ -266,22 +266,22 @@ class Branch {
* @return modified paths until {@code r}.
* @throws IllegalArgumentException if r is not a branch revision.
*/
- Iterable<String> getModifiedPathsUntil(@NotNull final Revision r) {
+ Iterable<Path> getModifiedPathsUntil(@NotNull final Revision r) {
checkArgument(checkNotNull(r).isBranch(),
"Not a branch revision: %s", r);
if (!commits.containsKey(r)) {
return Collections.emptyList();
}
- Iterable<Iterable<String>> paths = transform(filter(commits.entrySet(),
+ Iterable<Iterable<Path>> paths = transform(filter(commits.entrySet(),
new Predicate<Map.Entry<Revision, BranchCommit>>() {
@Override
public boolean apply(Map.Entry<Revision, BranchCommit> input) {
return !input.getValue().isRebase()
&& input.getKey().compareRevisionTime(r) <= 0;
}
- }), new Function<Map.Entry<Revision, BranchCommit>,
Iterable<String>>() {
+ }), new Function<Map.Entry<Revision, BranchCommit>, Iterable<Path>>() {
@Override
- public Iterable<String> apply(Map.Entry<Revision, BranchCommit>
input) {
+ public Iterable<Path> apply(Map.Entry<Revision, BranchCommit>
input) {
return input.getValue().getModifiedPaths();
}
});
@@ -310,9 +310,9 @@ class Branch {
abstract void applyTo(UnsavedModifications trunk, Revision commit);
- abstract boolean isModified(String path);
+ abstract boolean isModified(Path path);
- abstract Iterable<String> getModifiedPaths();
+ abstract Iterable<Path> getModifiedPaths();
protected abstract boolean isRebase();
}
@@ -322,7 +322,7 @@ class Branch {
*/
private static class BranchCommitImpl extends BranchCommit {
- private final Set<String> modifications = Sets.newHashSet();
+ private final Set<Path> modifications = Sets.newHashSet();
BranchCommitImpl(RevisionVector base, Revision commit) {
super(base, commit);
@@ -330,18 +330,18 @@ class Branch {
@Override
void applyTo(UnsavedModifications trunk, Revision commit) {
- for (String p : modifications) {
+ for (Path p : modifications) {
trunk.put(p, commit);
}
}
@Override
- boolean isModified(String path) { // TODO: rather pass NodeDocument?
+ boolean isModified(Path path) { // TODO: rather pass NodeDocument?
return modifications.contains(path);
}
@Override
- Iterable<String> getModifiedPaths() {
+ Iterable<Path> getModifiedPaths() {
return modifications;
}
@@ -353,7 +353,7 @@ class Branch {
//------------------< LastRevTracker
>----------------------------------
@Override
- public void track(String path) {
+ public void track(Path path) {
modifications.add(path);
}
@@ -381,7 +381,7 @@ class Branch {
}
@Override
- boolean isModified(String path) {
+ boolean isModified(Path path) {
for (BranchCommit c : previous.values()) {
if (c.isModified(path)) {
return true;
@@ -396,11 +396,11 @@ class Branch {
}
@Override
- Iterable<String> getModifiedPaths() {
- Iterable<Iterable<String>> paths = transform(previous.values(),
- new Function<BranchCommit, Iterable<String>>() {
+ Iterable<Path> getModifiedPaths() {
+ Iterable<Iterable<Path>> paths = transform(previous.values(),
+ new Function<BranchCommit, Iterable<Path>>() {
@Override
- public Iterable<String> apply(BranchCommit branchCommit) {
+ public Iterable<Path> apply(BranchCommit branchCommit) {
return branchCommit.getModifiedPaths();
}
});
@@ -426,7 +426,7 @@ class Branch {
//------------------< LastRevTracker
>----------------------------------
@Override
- public void track(String path) {
+ public void track(Path path) {
throw new UnsupportedOperationException("RebaseCommit is
read-only");
}
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Collision.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Collision.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Collision.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Collision.java
Wed Apr 10 11:13:19 2019
@@ -145,8 +145,8 @@ class Collision {
@NotNull Revision other,
@NotNull DocumentStore store,
@NotNull RevisionContext context) {
- String p = document.getPath();
- String commitRootPath;
+ Path p = document.getPath();
+ Path commitRootPath;
// first check if we can mark the commit with the given revision
if (document.containsRevision(revision)) {
if (isCommitted(context.getCommitValue(revision, document))) {
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java
Wed Apr 10 11:13:19 2019
@@ -62,7 +62,7 @@ public class Commit {
protected final DocumentNodeStore nodeStore;
private final RevisionVector baseRevision;
private final Revision revision;
- private final HashMap<String, UpdateOp> operations = new
LinkedHashMap<String, UpdateOp>();
+ private final HashMap<Path, UpdateOp> operations = new LinkedHashMap<>();
private final Set<Revision> collisions = new LinkedHashSet<Revision>();
private Branch b;
private Rollback rollback = Rollback.NONE;
@@ -71,14 +71,14 @@ public class Commit {
* List of all node paths which have been modified in this commit. In
addition to the nodes
* which are actually changed it also contains there parent node paths
*/
- private final HashSet<String> modifiedNodes = new HashSet<String>();
+ private final HashSet<Path> modifiedNodes = new HashSet<>();
- private final HashSet<String> addedNodes = new HashSet<String>();
- private final HashSet<String> removedNodes = new HashSet<String>();
+ private final HashSet<Path> addedNodes = new HashSet<>();
+ private final HashSet<Path> removedNodes = new HashSet<>();
/** Set of all nodes which have binary properties. **/
- private final HashSet<String> nodesWithBinaries = Sets.newHashSet();
- private final HashMap<String, String> bundledNodes = Maps.newHashMap();
+ private final HashSet<Path> nodesWithBinaries = new HashSet<>();
+ private final HashMap<Path, Path> bundledNodes = new HashMap<>();
/**
* Create a new Commit.
@@ -99,11 +99,11 @@ public class Commit {
Commit(@NotNull DocumentNodeStore nodeStore,
@NotNull Revision revision,
@Nullable RevisionVector baseRevision,
- @NotNull Map<String, UpdateOp> operations,
- @NotNull Set<String> addedNodes,
- @NotNull Set<String> removedNodes,
- @NotNull Set<String> nodesWithBinaries,
- @NotNull Map<String, String> bundledNodes) {
+ @NotNull Map<Path, UpdateOp> operations,
+ @NotNull Set<Path> addedNodes,
+ @NotNull Set<Path> removedNodes,
+ @NotNull Set<Path> nodesWithBinaries,
+ @NotNull Map<Path, Path> bundledNodes) {
this(nodeStore, revision, baseRevision);
this.operations.putAll(operations);
this.addedNodes.addAll(addedNodes);
@@ -112,7 +112,7 @@ public class Commit {
this.bundledNodes.putAll(bundledNodes);
}
- UpdateOp getUpdateOperationForNode(String path) {
+ UpdateOp getUpdateOperationForNode(Path path) {
UpdateOp op = operations.get(path);
if (op == null) {
op = createUpdateOp(path, revision, isBranchCommit());
@@ -121,7 +121,7 @@ public class Commit {
return op;
}
- static UpdateOp createUpdateOp(String path,
+ static UpdateOp createUpdateOp(Path path,
Revision revision,
boolean isBranch) {
String id = Utils.getIdFromPath(path);
@@ -162,7 +162,7 @@ public class Commit {
* modifications.
*/
@NotNull
- Iterable<String> getModifiedPaths() {
+ Iterable<Path> getModifiedPaths() {
return modifiedNodes;
}
@@ -248,7 +248,7 @@ public class Commit {
private void updateBinaryStatus() {
DocumentStore store = this.nodeStore.getDocumentStore();
- for (String path : this.nodesWithBinaries) {
+ for (Path path : this.nodesWithBinaries) {
NodeDocument nd = store.getIfCached(Collection.NODES,
Utils.getIdFromPath(path));
if ((nd == null) || !nd.hasBinary()) {
UpdateOp updateParentOp = getUpdateOperationForNode(path);
@@ -305,10 +305,10 @@ public class Commit {
// the visibility of the commit
String commitValue = baseBranchRevision != null ?
baseBranchRevision.getBranchRevision().toString() : "c";
DocumentStore store = nodeStore.getDocumentStore();
- String commitRootPath = null;
+ Path commitRootPath = null;
if (baseBranchRevision != null) {
// branch commits always use root node as commit root
- commitRootPath = "/";
+ commitRootPath = Path.ROOT;
}
ArrayList<UpdateOp> changedNodes = new ArrayList<UpdateOp>();
// operations are added to this list before they are executed,
@@ -316,23 +316,24 @@ public class Commit {
ArrayList<UpdateOp> opLog = new ArrayList<UpdateOp>();
// Compute the commit root
- for (String p : operations.keySet()) {
+ for (Path p : operations.keySet()) {
markChanged(p);
if (commitRootPath == null) {
commitRootPath = p;
} else {
- while (!PathUtils.isAncestor(commitRootPath, p)) {
- commitRootPath = PathUtils.getParentPath(commitRootPath);
- if (denotesRoot(commitRootPath)) {
+ while (!commitRootPath.isAncestorOf(p)) {
+ Path parent = commitRootPath.getParent();
+ if (parent == null) {
break;
}
+ commitRootPath = parent;
}
}
}
rollback = new Rollback(revision, opLog,
Utils.getIdFromPath(commitRootPath));
- for (String p : bundledNodes.keySet()){
+ for (Path p : bundledNodes.keySet()){
markChanged(p);
}
@@ -345,7 +346,7 @@ public class Commit {
store.create(JOURNAL, singletonList(doc.asUpdateOp(r)));
}
- int commitRootDepth = PathUtils.getDepth(commitRootPath);
+ int commitRootDepth = commitRootPath.getDepth();
// check if there are real changes on the commit root
boolean commitRootHasChanges = operations.containsKey(commitRootPath);
for (UpdateOp op : operations.values()) {
@@ -476,14 +477,13 @@ public class Commit {
}
private void updateParentChildStatus() {
- final Set<String> processedParents = Sets.newHashSet();
- for (String path : addedNodes) {
- if (denotesRoot(path)) {
+ final Set<Path> processedParents = Sets.newHashSet();
+ for (Path path : addedNodes) {
+ Path parentPath = path.getParent();
+ if (parentPath == null) {
continue;
}
- String parentPath = PathUtils.getParentPath(path);
-
if (processedParents.contains(parentPath)) {
continue;
}
@@ -725,10 +725,10 @@ public class Commit {
*/
void applyLastRevUpdates(boolean isBranchCommit) {
LastRevTracker tracker = nodeStore.createTracker(revision,
isBranchCommit);
- for (String path : modifiedNodes) {
+ for (Path path : modifiedNodes) {
UpdateOp op = operations.get(path);
// track _lastRev only when path is not for a bundled node state
- if ((op == null || !hasContentChanges(op) || denotesRoot(path))
+ if ((op == null || !hasContentChanges(op) || path.isRoot())
&& !isBundled(path)) {
// track intermediate node and root
tracker.track(path);
@@ -743,33 +743,30 @@ public class Commit {
* @param isBranchCommit whether this is a commit to a branch
*/
public void applyToCache(RevisionVector before, boolean isBranchCommit) {
- HashMap<String, ArrayList<String>> nodesWithChangedChildren = new
HashMap<String, ArrayList<String>>();
- for (String p : modifiedNodes) {
- if (denotesRoot(p)) {
+ HashMap<Path, ArrayList<Path>> nodesWithChangedChildren = new
HashMap<>();
+ for (Path p : modifiedNodes) {
+ if (p.isRoot()) {
continue;
}
- String parent = PathUtils.getParentPath(p);
- ArrayList<String> list = nodesWithChangedChildren.get(parent);
- if (list == null) {
- list = new ArrayList<String>();
- nodesWithChangedChildren.put(parent, list);
- }
+ Path parent = p.getParent();
+ ArrayList<Path> list = nodesWithChangedChildren
+ .computeIfAbsent(parent, k -> new ArrayList<>());
list.add(p);
}
// the commit revision with branch flag if this is a branch commit
Revision rev = isBranchCommit ? revision.asBranchRevision() : revision;
RevisionVector after = before.update(rev);
DiffCache.Entry cacheEntry = nodeStore.getDiffCache().newEntry(before,
after, true);
- List<String> added = new ArrayList<String>();
- List<String> removed = new ArrayList<String>();
- List<String> changed = new ArrayList<String>();
- for (String path : modifiedNodes) {
+ List<Path> added = new ArrayList<>();
+ List<Path> removed = new ArrayList<>();
+ List<Path> changed = new ArrayList<>();
+ for (Path path : modifiedNodes) {
added.clear();
removed.clear();
changed.clear();
- ArrayList<String> changes = nodesWithChangedChildren.get(path);
+ ArrayList<Path> changes = nodesWithChangedChildren.get(path);
if (changes != null) {
- for (String s : changes) {
+ for (Path s : changes) {
if (addedNodes.contains(s)) {
added.add(s);
} else if (removedNodes.contains(s)) {
@@ -801,41 +798,38 @@ public class Commit {
* @param changed the list of changed child nodes
* @param cacheEntry the cache entry changes are added to
*/
- private void addChangesToDiffCacheEntry(String path,
- List<String> added,
- List<String> removed,
- List<String> changed,
+ private void addChangesToDiffCacheEntry(Path path,
+ List<Path> added,
+ List<Path> removed,
+ List<Path> changed,
DiffCache.Entry cacheEntry) {
// update diff cache
JsopWriter w = new JsopStream();
- for (String p : added) {
- w.tag('+').key(PathUtils.getName(p)).object().endObject();
+ for (Path p : added) {
+ w.tag('+').key(p.getName()).object().endObject();
}
- for (String p : removed) {
- w.tag('-').value(PathUtils.getName(p));
+ for (Path p : removed) {
+ w.tag('-').value(p.getName());
}
- for (String p : changed) {
- w.tag('^').key(PathUtils.getName(p)).object().endObject();
+ for (Path p : changed) {
+ w.tag('^').key(p.getName()).object().endObject();
}
cacheEntry.append(path, w.toString());
}
- private void markChanged(String path) {
- if (!denotesRoot(path) && !PathUtils.isAbsolute(path)) {
- throw new IllegalArgumentException("path: " + path);
- }
+ private void markChanged(Path path) {
while (true) {
if (!modifiedNodes.add(path)) {
break;
}
- if (denotesRoot(path)) {
+ path = path.getParent();
+ if (path == null) {
break;
}
- path = PathUtils.getParentPath(path);
}
}
- private boolean isBundled(String path) {
+ private boolean isBundled(Path path) {
return bundledNodes.containsKey(path);
}
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilder.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilder.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilder.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilder.java
Wed Apr 10 11:13:19 2019
@@ -30,6 +30,7 @@ import org.apache.jackrabbit.oak.spi.sta
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
@@ -43,14 +44,14 @@ class CommitBuilder {
private final DocumentNodeStore nodeStore;
private final Revision revision;
private final RevisionVector baseRevision;
- private final Map<String, UpdateOp> operations = new LinkedHashMap<>();
+ private final Map<Path, UpdateOp> operations = new LinkedHashMap<>();
- private final Set<String> addedNodes = new HashSet<>();
- private final Set<String> removedNodes = new HashSet<>();
+ private final Set<Path> addedNodes = new HashSet<>();
+ private final Set<Path> removedNodes = new HashSet<>();
/** Set of all nodes which have binary properties. **/
- private final Set<String> nodesWithBinaries = new HashSet<>();
- private final Map<String, String> bundledNodes = new HashMap<>();
+ private final Set<Path> nodesWithBinaries = new HashSet<>();
+ private final Map<Path, Path> bundledNodes = new HashMap<>();
/**
* Creates a new builder with a pseudo commit revision. Building the commit
@@ -103,7 +104,7 @@ class CommitBuilder {
* @return {@code this} builder.
*/
@NotNull
- CommitBuilder addNode(@NotNull String path) {
+ CommitBuilder addNode(@NotNull Path path) {
addNode(new DocumentNodeState(nodeStore, path, new
RevisionVector(revision)));
return this;
}
@@ -121,7 +122,7 @@ class CommitBuilder {
throws DocumentStoreException {
checkNotNull(node);
- String path = node.getPath();
+ Path path = node.getPath();
UpdateOp op = node.asOperation(revision);
if (operations.containsKey(path)) {
String msg = "Node already added: " + path;
@@ -144,8 +145,8 @@ class CommitBuilder {
* @return {@code this} builder.
*/
@NotNull
- CommitBuilder addBundledNode(@NotNull String path,
- @NotNull String bundlingRootPath) {
+ CommitBuilder addBundledNode(@NotNull Path path,
+ @NotNull Path bundlingRootPath) {
checkNotNull(path);
checkNotNull(bundlingRootPath);
@@ -163,7 +164,7 @@ class CommitBuilder {
* a node at the given {@code path} in this commit builder.
*/
@NotNull
- CommitBuilder removeNode(@NotNull String path,
+ CommitBuilder removeNode(@NotNull Path path,
@NotNull NodeState state)
throws DocumentStoreException {
checkNotNull(path);
@@ -192,7 +193,7 @@ class CommitBuilder {
* @return {@code this} builder.
*/
@NotNull
- CommitBuilder updateProperty(@NotNull String path,
+ CommitBuilder updateProperty(@NotNull Path path,
@NotNull String propertyName,
@Nullable String value) {
checkNotNull(path);
@@ -212,7 +213,7 @@ class CommitBuilder {
* @return {@code this} builder.
*/
@NotNull
- CommitBuilder markNodeHavingBinary(@NotNull String path) {
+ CommitBuilder markNodeHavingBinary(@NotNull Path path) {
checkNotNull(path);
nodesWithBinaries.add(path);
@@ -248,7 +249,7 @@ class CommitBuilder {
checkNotNull(revision);
Revision from = this.revision;
- Map<String, UpdateOp> operations = Maps.transformValues(
+ Map<Path, UpdateOp> operations = Maps.transformValues(
this.operations, op -> rewrite(op, from, revision));
return new Commit(nodeStore, revision, baseRevision, operations,
addedNodes, removedNodes, nodesWithBinaries, bundledNodes);
@@ -266,7 +267,7 @@ class CommitBuilder {
//-------------------------< internal
>-------------------------------------
- private UpdateOp getUpdateOperationForNode(String path) {
+ private UpdateOp getUpdateOperationForNode(Path path) {
UpdateOp op = operations.get(path);
if (op == null) {
op = createUpdateOp(path, revision, isBranchCommit());
@@ -275,7 +276,7 @@ class CommitBuilder {
return op;
}
- private static UpdateOp createUpdateOp(String path,
+ private static UpdateOp createUpdateOp(Path path,
Revision revision,
boolean isBranch) {
String id = Utils.getIdFromPath(path);
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DiffCache.java
Wed Apr 10 11:13:19 2019
@@ -47,12 +47,12 @@ abstract class DiffCache {
@Nullable
abstract String getChanges(@NotNull RevisionVector from,
@NotNull RevisionVector to,
- @NotNull String path,
+ @NotNull Path path,
@Nullable Loader loader);
/**
* Starts a new cache entry for the diff cache. Actual changes are added
- * to the entry with the {@link Entry#append(String, String)} method.
+ * to the entry with the {@link Entry#append(Path, String)} method.
*
* @param from the from revision.
* @param to the to revision.
@@ -73,7 +73,7 @@ abstract class DiffCache {
/**
* Parses the jsop diff returned by
- * {@link #getChanges(RevisionVector, RevisionVector, String, Loader)} and
reports the
+ * {@link #getChanges(RevisionVector, RevisionVector, Path, Loader)} and
reports the
* changes by calling the appropriate methods on {@link Diff}.
*
* @param jsop the jsop diff to parse.
@@ -134,7 +134,7 @@ abstract class DiffCache {
* @param path the path of the parent node.
* @param changes the child node changes.
*/
- void append(@NotNull String path,
+ void append(@NotNull Path path,
@NotNull String changes);
/**
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentBranchRootNodeState.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentBranchRootNodeState.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentBranchRootNodeState.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentBranchRootNodeState.java
Wed Apr 10 11:13:19 2019
@@ -32,11 +32,12 @@ class DocumentBranchRootNodeState extend
DocumentBranchRootNodeState(@NotNull DocumentNodeStore store,
@NotNull DocumentNodeStoreBranch branch,
- @NotNull String path,
+ @NotNull Path path,
@NotNull RevisionVector rootRevision,
@Nullable RevisionVector lastRevision,
- @NotNull BundlingContext bundlingContext) {
- super(store, path, lastRevision, rootRevision, false, bundlingContext);
+ @NotNull BundlingContext bundlingContext,
+ int memory) {
+ super(store, path, lastRevision, rootRevision, false, bundlingContext,
memory);
this.store = store;
this.branch = checkNotNull(branch);
}
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
Wed Apr 10 11:13:19 2019
@@ -20,14 +20,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
import com.google.common.collect.TreeTraverser;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.cache.CacheValue;
@@ -35,7 +32,6 @@ import org.apache.jackrabbit.oak.commons
import org.apache.jackrabbit.oak.commons.json.JsopReader;
import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.json.JsopWriter;
import org.apache.jackrabbit.oak.json.JsonSerializer;
import org.apache.jackrabbit.oak.plugins.document.bundlor.BundlorUtils;
@@ -82,7 +78,7 @@ public class DocumentNodeState extends A
*/
static final int MAX_FETCH_SIZE = INITIAL_FETCH_SIZE << 4;
- private final String path;
+ private final Path path;
private final RevisionVector lastRevision;
private final RevisionVector rootRevision;
private final boolean fromExternalChange;
@@ -93,39 +89,42 @@ public class DocumentNodeState extends A
private final BundlingContext bundlingContext;
private AbstractDocumentNodeState cachedSecondaryState;
+ private int memory;
DocumentNodeState(@NotNull DocumentNodeStore store,
- @NotNull String path,
+ @NotNull Path path,
@NotNull RevisionVector rootRevision) {
this(store, path, rootRevision,
Collections.<PropertyState>emptyList(), false, null);
}
- DocumentNodeState(@NotNull DocumentNodeStore store, @NotNull String path,
+ DocumentNodeState(@NotNull DocumentNodeStore store, @NotNull Path path,
@NotNull RevisionVector rootRevision,
Iterable<? extends PropertyState> properties,
boolean hasChildren,
@Nullable RevisionVector lastRevision) {
this(store, path, rootRevision, asMap(properties),
- hasChildren, lastRevision, false);
+ hasChildren, 0, lastRevision, false);
}
- private DocumentNodeState(@NotNull DocumentNodeStore store,
- @NotNull String path,
- @NotNull RevisionVector rootRevision,
- @NotNull Map<String, PropertyState> properties,
- boolean hasChildren,
- @Nullable RevisionVector lastRevision,
- boolean fromExternalChange) {
+ public DocumentNodeState(@NotNull DocumentNodeStore store,
+ @NotNull Path path,
+ @NotNull RevisionVector rootRevision,
+ @NotNull Map<String, PropertyState> properties,
+ boolean hasChildren,
+ int memory,
+ @Nullable RevisionVector lastRevision,
+ boolean fromExternalChange) {
this(store, path, lastRevision, rootRevision,
- fromExternalChange,
createBundlingContext(checkNotNull(properties), hasChildren));
+ fromExternalChange,
createBundlingContext(checkNotNull(properties), hasChildren), memory);
}
protected DocumentNodeState(@NotNull DocumentNodeStore store,
- @NotNull String path,
- @Nullable RevisionVector lastRevision,
- @Nullable RevisionVector rootRevision,
- boolean fromExternalChange,
- BundlingContext bundlingContext) {
+ @NotNull Path path,
+ @Nullable RevisionVector lastRevision,
+ @NotNull RevisionVector rootRevision,
+ boolean fromExternalChange,
+ BundlingContext bundlingContext,
+ int memory) {
this.store = checkNotNull(store);
this.path = checkNotNull(path);
this.rootRevision = checkNotNull(rootRevision);
@@ -134,6 +133,7 @@ public class DocumentNodeState extends A
this.properties = bundlingContext.getProperties();
this.bundlingContext = bundlingContext;
this.hasChildren = bundlingContext.hasChildren();
+ this.memory = memory;
}
/**
@@ -155,7 +155,7 @@ public class DocumentNodeState extends A
if (rootRevision.equals(root) && fromExternalChange == externalChange)
{
return this;
} else {
- return new DocumentNodeState(store, path, lastRevision, root,
externalChange, bundlingContext);
+ return new DocumentNodeState(store, path, lastRevision, root,
externalChange, bundlingContext, memory);
}
}
@@ -165,7 +165,7 @@ public class DocumentNodeState extends A
*/
@NotNull
public DocumentNodeState fromExternalChange() {
- return new DocumentNodeState(store, path, lastRevision, rootRevision,
true, bundlingContext);
+ return new DocumentNodeState(store, path, lastRevision, rootRevision,
true, bundlingContext, memory);
}
/**
@@ -180,9 +180,9 @@ public class DocumentNodeState extends A
*/
@NotNull
DocumentNodeState asBranchRootState(@NotNull DocumentNodeStoreBranch
branch) {
- checkState(PathUtils.denotesRoot(path));
+ checkState(path.isRoot());
checkState(getRootRevision().isBranch());
- return new DocumentBranchRootNodeState(store, branch, path,
rootRevision, lastRevision, bundlingContext);
+ return new DocumentBranchRootNodeState(store, branch, path,
rootRevision, lastRevision, bundlingContext, memory);
}
/**
@@ -210,7 +210,7 @@ public class DocumentNodeState extends A
}
@Override
- public String getPath() {
+ public Path getPath() {
return path;
}
@@ -284,7 +284,7 @@ public class DocumentNodeState extends A
return bundledChildCount;
}
- String name = null;
+ String name = "";
long count = 0;
int fetchSize = INITIAL_FETCH_SIZE;
long remaining = Math.max(max, 1); // fetch at least once
@@ -347,7 +347,7 @@ public class DocumentNodeState extends A
@NotNull
@Override
public NodeBuilder builder() {
- if ("/".equals(getPath())) {
+ if (getPath().isRoot()) {
if (getRootRevision().isBranch()) {
throw new IllegalStateException("Cannot create builder from
branched DocumentNodeState");
} else {
@@ -416,8 +416,8 @@ public class DocumentNodeState extends A
UpdateOp asOperation(@NotNull Revision revision) {
String id = Utils.getIdFromPath(path);
UpdateOp op = new UpdateOp(id, true);
- if (Utils.isLongPath(path)) {
- op.set(NodeDocument.PATH, path);
+ if (Utils.isIdFromLongPath(id)) {
+ op.set(NodeDocument.PATH, path.toString());
}
NodeDocument.setModified(op, revision);
NodeDocument.setDeleted(op, revision, false);
@@ -430,36 +430,40 @@ public class DocumentNodeState extends A
@Override
public int getMemory() {
- long size = 40 // shallow
- + (lastRevision != null ? lastRevision.getMemory() : 0)
- + rootRevision.getMemory()
- + estimateMemoryUsage(path);
- // rough approximation for properties
- for (Map.Entry<String, PropertyState> entry :
bundlingContext.getAllProperties().entrySet()) {
- // name
- size += estimateMemoryUsage(entry.getKey());
- PropertyState propState = entry.getValue();
- if (propState.getType() != Type.BINARY
- && propState.getType() != Type.BINARIES) {
- for (int i = 0; i < propState.count(); i++) {
- // size() returns length of string
- // shallow memory:
- // - 8 bytes per reference in values list
- // - 48 bytes per string
- // double usage per property because of parsed
PropertyState
- size += (56 + propState.size(i) * 2) * 2;
+ long size = memory;
+ if (size == 0) {
+ size = 40 // shallow
+ + (lastRevision != null ? lastRevision.getMemory() : 0)
+ + rootRevision.getMemory()
+ + path.getMemory();
+ // rough approximation for properties
+ for (Map.Entry<String, PropertyState> entry :
bundlingContext.getAllProperties().entrySet()) {
+ // name
+ size += estimateMemoryUsage(entry.getKey());
+ PropertyState propState = entry.getValue();
+ if (propState.getType() != Type.BINARY
+ && propState.getType() != Type.BINARIES) {
+ for (int i = 0; i < propState.count(); i++) {
+ // size() returns length of string
+ // shallow memory:
+ // - 8 bytes per reference in values list
+ // - 48 bytes per string
+ // double usage per property because of parsed
PropertyState
+ size += (56 + propState.size(i) * 2) * 2;
+ }
+ } else {
+ // calculate size based on blobId value
+ // referencing the binary in the blob store
+ // double the size because the parsed PropertyState
+ // will have a similarly sized blobId as well
+ size +=
(long)estimateMemoryUsage(asString(entry.getValue())) * 2;
}
- } else {
- // calculate size based on blobId value
- // referencing the binary in the blob store
- // double the size because the parsed PropertyState
- // will have a similarly sized blobId as well
- size += (long)estimateMemoryUsage(asString(entry.getValue()))
* 2;
}
- }
- if (size > Integer.MAX_VALUE) {
- log.debug("Estimated memory footprint larger than
Integer.MAX_VALUE: {}.", size);
- size = Integer.MAX_VALUE;
+ if (size > Integer.MAX_VALUE) {
+ log.debug("Estimated memory footprint larger than
Integer.MAX_VALUE: {}.", size);
+ size = Integer.MAX_VALUE;
+ }
+ memory = (int) size;
}
return (int) size;
}
@@ -474,6 +478,19 @@ public class DocumentNodeState extends A
.filter(dns -> !dns.getPath().equals(this.getPath()) ); //Exclude this
}
+ /**
+ * Returns all properties, including bundled, as Json serialized value.
+ *
+ * @return all properties, including bundled.
+ */
+ public Map<String, String> getAllBundledProperties() {
+ Map<String, String> allProps = new HashMap<>();
+ for (Map.Entry<String, PropertyState> e :
bundlingContext.getAllProperties().entrySet()) {
+ allProps.put(e.getKey(), asString(e.getValue()));
+ }
+ return allProps;
+ }
+
//------------------------------< internal
>--------------------------------
@Nullable
@@ -500,7 +517,7 @@ public class DocumentNodeState extends A
return null;
}
- return store.getNode(concat(getPath(), childNodeName), lastRevision);
+ return store.getNode(new Path(getPath(), childNodeName), lastRevision);
}
@Nullable
@@ -517,13 +534,13 @@ public class DocumentNodeState extends A
* {@code name}.
*
* @param name the name of the lower bound child node entry (exclusive) or
- * {@code null}, if the method should start with the first
known
- * child node.
+ * the empty {@code String}, if the method should start with
the
+ * first known child node.
* @param limit the maximum number of child node entries to return.
* @return the child node entries.
*/
@NotNull
- private Iterable<ChildNodeEntry> getChildNodeEntries(@Nullable String name,
+ private Iterable<ChildNodeEntry> getChildNodeEntries(@NotNull String name,
int limit) {
Iterable<? extends AbstractDocumentNodeState> children =
store.getChildNodes(this, name, limit);
return Iterables.transform(children, new
Function<AbstractDocumentNodeState, ChildNodeEntry>() {
@@ -533,7 +550,7 @@ public class DocumentNodeState extends A
@NotNull
@Override
public String getName() {
- return PathUtils.getName(input.getPath());
+ return input.getPath().getName();
}
@NotNull
@@ -554,72 +571,6 @@ public class DocumentNodeState extends A
return builder.build();
}
- public String asString() {
- JsopWriter json = new JsopBuilder();
- json.key("path").value(path);
- json.key("rev").value(rootRevision.toString());
- if (lastRevision != null) {
- json.key("lastRev").value(lastRevision.toString());
- }
- if (hasChildren) {
- json.key("hasChildren").value(true);
- }
- if (properties.size() > 0) {
- json.key("prop").object();
- for (Map.Entry<String, PropertyState> e :
bundlingContext.getAllProperties().entrySet()) {
- json.key(e.getKey()).value(asString(e.getValue()));
- }
- json.endObject();
- }
- return json.toString();
- }
-
- public static DocumentNodeState fromString(DocumentNodeStore store, String
s) {
- JsopTokenizer json = new JsopTokenizer(s);
- String path = null;
- RevisionVector rootRev = null;
- RevisionVector lastRev = null;
- boolean hasChildren = false;
- HashMap<String, String> map = new HashMap<String, String>();
- while (true) {
- String k = json.readString();
- json.read(':');
- if ("path".equals(k)) {
- path = json.readString();
- } else if ("rev".equals(k)) {
- rootRev = RevisionVector.fromString(json.readString());
- } else if ("lastRev".equals(k)) {
- lastRev = RevisionVector.fromString(json.readString());
- } else if ("hasChildren".equals(k)) {
- hasChildren = json.read() == JsopReader.TRUE;
- } else if ("prop".equals(k)) {
- json.read('{');
- while (true) {
- if (json.matches('}')) {
- break;
- }
- k = json.readString();
- json.read(':');
- String v = json.readString();
- map.put(k, v);
- json.matches(',');
- }
- }
- if (json.matches(JsopReader.END)) {
- break;
- }
- json.read(',');
- }
- List<PropertyState> props = Lists.newArrayListWithCapacity(map.size());
- for (Entry<String, String> e : map.entrySet()) {
- String value = e.getValue();
- if (value != null) {
- props.add(store.createPropertyState(e.getKey(), value));
- }
- }
- return new DocumentNodeState(store, path, rootRev, props, hasChildren,
lastRev);
- }
-
/**
* A list of children for a node.
*/
@@ -706,7 +657,7 @@ public class DocumentNodeState extends A
private class ChildNodeEntryIterator implements Iterator<ChildNodeEntry> {
- private String previousName;
+ private String previousName = "";
private Iterator<ChildNodeEntry> current;
private int fetchSize = INITIAL_FETCH_SIZE;
private int currentRemaining = fetchSize;
@@ -764,11 +715,12 @@ public class DocumentNodeState extends A
private AbstractDocumentNodeState createBundledState(String childNodeName,
Matcher child) {
return new DocumentNodeState(
store,
- concat(path, childNodeName),
+ new Path(path, childNodeName),
lastRevision,
rootRevision,
fromExternalChange,
- bundlingContext.childContext(child));
+ bundlingContext.childContext(child),
+ memory);
}
private Iterator<ChildNodeEntry> getBundledChildren(){
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateCache.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateCache.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateCache.java
(original)
+++
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateCache.java
Wed Apr 10 11:13:19 2019
@@ -25,13 +25,13 @@ import org.jetbrains.annotations.Nullabl
public interface DocumentNodeStateCache {
DocumentNodeStateCache NOOP = new DocumentNodeStateCache() {
@Override
- public AbstractDocumentNodeState getDocumentNodeState(String path,
@Nullable RevisionVector rootRevision,
+ public AbstractDocumentNodeState getDocumentNodeState(Path path,
@Nullable RevisionVector rootRevision,
RevisionVector
lastRev) {
return null;
}
@Override
- public boolean isCached(String path) {
+ public boolean isCached(Path path) {
return false;
}
};
@@ -47,14 +47,14 @@ public interface DocumentNodeStateCache
* path is not cached then <code>null</code> would be returned
*/
@Nullable
- AbstractDocumentNodeState getDocumentNodeState(String path, RevisionVector
rootRevision, RevisionVector lastRev);
+ AbstractDocumentNodeState getDocumentNodeState(Path path, RevisionVector
rootRevision, RevisionVector lastRev);
/**
* Determines if given path is cached by this implementation
* @param path path to check
* @return true if given path is cached
*/
- boolean isCached(String path);
+ boolean isCached(Path path);
}