You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2016/06/21 06:20:36 UTC
svn commit: r1749438 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
Author: chetanm
Date: Tue Jun 21 06:20:36 2016
New Revision: 1749438
URL: http://svn.apache.org/viewvc?rev=1749438&view=rev
Log:
OAK-4180 - Use another NodeStore as a local cache for a remote Document store
Avoid traversing the full path if lastRev exceeds for intermediate nodes
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java?rev=1749438&r1=1749437&r2=1749438&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java Tue Jun 21 06:20:36 2016
@@ -110,7 +110,7 @@ class SecondaryStoreCache implements Doc
if (matchingRoot != null){
NodeState state = NodeStateUtils.getNode(matchingRoot, path);
if (state.exists()){
- AbstractDocumentNodeState docState = (AbstractDocumentNodeState) state;
+ AbstractDocumentNodeState docState = asDocState(state);
prevRevMatched.mark();
return docState;
}
@@ -126,11 +126,16 @@ class SecondaryStoreCache implements Doc
NodeState state = root;
for (String name : PathUtils.elements(path)) {
+ if (state.exists()){
+ if (lastRev.compareTo(asDocState(state).getLastRevision()) > 0){
+ return null;
+ }
+ }
state = state.getChildNode(name);
}
if (state.exists()) {
- AbstractDocumentNodeState docState = (AbstractDocumentNodeState) state;
+ AbstractDocumentNodeState docState = asDocState(state);
if (lastRev.equals(docState.getLastRevision())) {
headRevMatched.mark();
return docState;
@@ -203,4 +208,9 @@ class SecondaryStoreCache implements Doc
}
return null; // key not found.
}
+
+ private static AbstractDocumentNodeState asDocState(NodeState state) {
+ return (AbstractDocumentNodeState)state;
+ }
+
}