[ 
https://issues.apache.org/jira/browse/OAK-7101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16311131#comment-16311131
 ] 

Julian Reschke commented on OAK-7101:
-------------------------------------

Tried:

{noformat}
--- 
src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
  (Revision 1820046)
+++ 
src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
  (Arbeitskopie)
@@ -1693,13 +1693,12 @@
             if (lastmodified == row.getModified() && lastmodified >= 1) {
                 if (modCount <= cachedModCount) {
                     // we can use the cached document
-                    Lock lock = locks.acquire(row.getId());
+                    Lock lock = locks.acquire(id);
                     try {
                         if (qp.mayUpdate(id)) {
                             inCache.markUpToDate(now);
                         }
-                    }
-                    finally {
+                    } finally {
                         lock.unlock();
                     }
                     return castAsT(inCache);
@@ -1710,11 +1709,15 @@
         NodeDocument fresh = (NodeDocument) convertFromDBObject(collection, 
row);
         fresh.seal();

-        if (!qp.mayUpdate(id)) {
-            return castAsT(fresh);
+        Lock lock = locks.acquire(id);
+        try {
+            if (qp.mayUpdate(id)) {
+                nodesCache.putIfNewer(fresh);
+            }
+        } finally {
+            lock.unlock();
         }

-        nodesCache.putIfNewer(fresh);
         return castAsT(fresh);
     }
{noformat}

but test continues to fail...

> Stale documents in RDBDocumentStore cache
> -----------------------------------------
>
>                 Key: OAK-7101
>                 URL: https://issues.apache.org/jira/browse/OAK-7101
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: rdbmk
>    Affects Versions: 1.0, 1.4.0, 1.6.0, 1.2.0
>            Reporter: Marcel Reutegger
>            Assignee: Julian Reschke
>             Fix For: 1.0.40, 1.4.19, 1.6.8, 1.8, 1.2.28, 1.7.15
>
>         Attachments: OAK-7101.patch, oak-7101.png, query-lock.diff
>
>
> Concurrent query and update operations on RDBDocumentStore may result in 
> stale entries in the document cache.
> Potentially related issues are OAK-5387 and OAK-6062.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to