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

Marcel Reutegger commented on OAK-7101:
---------------------------------------

When {{mayUpdate}} and {{putIfNewer}} are surrounded with a lock, they will 
either get executed before or after the update. Both will result in a correct 
execution.

# Before: mayUpdate() returns {{true}} and the {{fresh}} (correct) document is 
put into the cache. The update modifies the document and adds the key into the 
query context (does not affect the query in this case). Then either replace the 
document put into the cache by the query, or does not update the cache in case 
the document was evicted in the meantime.
# After: the update modifies the document and adds the key to the query 
context. Assuming the document is not present in the cache, 
replaceCachedDocument will be a NOP. The query then calls mayUpdate, which 
returns {{false}}.

With this additional synchronization the test runs successfully on my machine 
for quite a while now.

[~reschke], WDYT?

> 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