Andrus Adamchik created CAY-2123:

             Summary: Synchronizing cache updates with external trasnaction 
                 Key: CAY-2123
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 4.0.M3, 3.1.1
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik

Some of the steps in the commit sequence should work differently when Cayenne 
is operating under external transactions. One scenario is shared cache 
synchronization. E.g.:

1. Thread A commits ObjectContext. Under external transaction this results in a 
flush operation, pending tx commit/rollback
2. Thread B runs an operation that hits the cache (e.g. reads a to-one 
relationship). It gets values committed under thread A
3. Thread A rolls back its transaction... Invalid value gets stuck in shared 
cache. Now all threads will see it.

This behavior results in dirty reads regardless of the actual transaction 
isolation level. Looks like we'll need to make our cache transaction-aware and 
provide an API for committing cache state on external transaction events. The 
initial implementation for this API may be targeting Spring transactions.

Things may become even more complicated when multiple overlapping threads 
change the same object. "snapshot version changed" message in the logs is a 
symptom of this inconsistency. 

This message was sent by Atlassian JIRA

Reply via email to