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

Andrey Gura commented on IGNITE-2969:
-------------------------------------

[~sboikov], I see only one reliable way to provide proper synchronization. 
Because {{GridNearOptimisticTxPrepareFuture}} sends all 
{{GridNearTxPrepareRequest}} sequentially and always awaits response before 
sending next request we can use this property.

Main synchronization point is 
{{GridNearOptimisticTxPrepareFuture.proceedPrepare()}} method that should not 
make progress (send next request) in case of timeout happened. Instead it 
should call deadlock detection task and finish without future completion.

Synchronization primitive in this case just atomic reference that contains 
{{null}} value before timeout. So we initialize this reference by deadlock 
detection task (some kind of {{Runnable}}) on timeout and use {{cas(null, 
null)}} before make progress in {{proceedPrepare}} method.

Thus deadlock detection can be started only when there are now requests in 
progress. It will allow to avoid creation {{DhtTxLocal}} and {{DhtTxRemote}} 
instances after or concurrently with transaction finishing.

I've implemented POC and it seems to work.

Does it makes sense?

> Optimistic transactions support in deadlock detection
> -----------------------------------------------------
>
>                 Key: IGNITE-2969
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2969
>             Project: Ignite
>          Issue Type: Improvement
>          Components: cache
>            Reporter: Andrey Gura
>            Assignee: Andrey Gura
>             Fix For: 1.7
>
>
> Deadlock detection doesn't support optimistic transactions now. It should be 
> implemented.



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

Reply via email to