Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java
===================================================================
--- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java	(revision 1741972)
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/cache/NodeDocumentCache.java	(working copy)
@@ -202,11 +202,12 @@
      * already or the cached document is older (has smaller {@link Document#MOD_COUNT}).
      *
      * @param doc the document to add to the cache
+     * @param cachedDoc the document presently in the cache (can be <code>null</code>)
      * @return either the given <code>doc</code> or the document already present
      *         in the cache if it's newer
      */
     @Nonnull
-    public NodeDocument putIfNewer(@Nonnull final NodeDocument doc) {
+    public NodeDocument putIfNewer(@Nonnull final NodeDocument doc, @Nullable final NodeDocument cachedDoc) {
         if (doc == NodeDocument.NULL) {
             throw new IllegalArgumentException("doc must not be NULL document");
         }
@@ -217,7 +218,6 @@
         String id = doc.getId();
         Lock lock = locks.acquire(id);
         try {
-            NodeDocument cachedDoc = getIfPresent(id);
             if (cachedDoc == null || cachedDoc == NodeDocument.NULL) {
                 newerDoc = doc;
                 putInternal(doc);
@@ -439,13 +439,14 @@
             String id = d.getId();
             Lock lock = locks.acquire(id);
             try {
+                NodeDocument cachedDoc = getIfPresent(id);
                 // if an old document is present in the cache, we can simply update it
-                if (getIfPresent(id) != null) {
-                    putIfNewer(d);
+                if (cachedDoc != null) {
+                    putIfNewer(d, cachedDoc);
                 // if the document hasn't been invalidated or added during the tracker lifetime,
                 // we can put it as well
                 } else if (!tracker.mightBeenAffected(id)) {
-                    putIfNewer(d);
+                    putIfNewer(d, cachedDoc);
                 }
             } finally {
                 lock.unlock();
Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
===================================================================
--- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java	(revision 1741957)
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java	(working copy)
@@ -1897,7 +1897,7 @@
             return castAsT(fresh);
         }
 
-        nodesCache.putIfNewer(fresh);
+        nodesCache.putIfNewer(fresh, inCache);
         return castAsT(fresh);
     }
 
