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

Julian Reschke commented on OAK-3566:
-------------------------------------

[~mreutegg] thanks.

So if I understand correctly, the following sequence of events leads to stale 
data in the cache:

1) Node hierarchy is created
2) A query on a folder in this hierarchy starts and is "slow" (here essentially 
by simulating a breakpoint)
3) DocumentNodeStore background threads run, updating the same nodes with a 
DocumentStore operation that can be implemented as update on a non-known state, 
thus the documents are not read from the DB, and the cache is not populated (*) 
with the new versions (as their state is not known and does not need to known)
4) Query (2) finishes, and populates the cache with out-of-date versions of the 
documents

This is a problem because the outdated results will be visible to the thread 
that actually created the node hierarchy.

If this is correct, fixing this might be possible without introducing TreeLocks 
as it was done for MongoDocumentStore. 

Instead, in step 3 (*), we could insert a placeholder into the cache that just 
records the fact that the given document has been changed, and that a) that 
entry can't be updated by a query result, and b) it *will* be read from the DB 
next time it's needed. I'll experiment with this approach first...

> Stale documents in RDBDocumentStore cache
> -----------------------------------------
>
>                 Key: OAK-3566
>                 URL: https://issues.apache.org/jira/browse/OAK-3566
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core, rdbmk
>    Affects Versions: 1.0, 1.2
>            Reporter: Marcel Reutegger
>            Assignee: Julian Reschke
>         Attachments: OAK-3566.patch
>
>
> This issue is about the same problem as described in OAK-1897 but for the 
> RDBDocumentStore implementation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to