[ 
https://issues.apache.org/jira/browse/IGNITE-17615?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladislav Pyatkov reassigned IGNITE-17615:
------------------------------------------

    Assignee: Vladislav Pyatkov

> Close local cursors on primary replica expiration
> -------------------------------------------------
>
>                 Key: IGNITE-17615
>                 URL: https://issues.apache.org/jira/browse/IGNITE-17615
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Sergey Uttsel
>            Assignee: Vladislav Pyatkov
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> h3. Motivation
> According to our tx protocol, it’s impossible to commit a transaction if any 
> of the enlisted primary replicas have expired. It also means that there’s no 
> sense in preserving tx related volatile state such as locks and cursors. Pay 
> attention, that it’s still useful to preserve txnState in the 
> txnStateLocalMap because it will ease write intent resolution procedure. 
> Locks release on primary replica expiration was already implemented, so this 
> ticket is only about closing cursors on primary expiration.
> h3. Definition of Done
>  * On primary replica expiration all RW-scoped cursors are closed.
> h3. Implementation Notes
> 1.In 
> `org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#onPrimaryExpired`
>  we release all tx locks
> {code:java}
> futs.add(allOf(txFuts).whenComplete((unused, throwable) -> 
> releaseTxLocks(txId)));
> {code}
> Seems reasonable to reuse same event to close the cursors. Worth mentioning 
> that given action should be asynchronous. I believe that we may do the 
> cursors close in partition striped pool. See StripedThreadPoolExecutor for 
> more details. Another option here is to introduce special dedicated cleanup 
> thread and use it instead. That will be a part of TX Resourse Cleanup design.
> 2. So, that was about when to close, let’s clarify what to close. Seems that 
> it’s trivial. We have 
> `org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#cursors`
>  right in partition replica listeners. We even have corresponding helper 
> method 
> `org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#closeAllTransactionCursors`
>  
> All in all, seems that it's required to substitute
>  
> {code:java}
> futs.add(allOf(txFuts).whenComplete((unused, throwable) -> 
> releaseTxLocks(txId)));{code}
> with
> {code:java}
>                     futs.add(allOf(txFuts).whenComplete((unused, throwable) 
> -> {
>                         releaseTxLocks(txId);
>                         try {
>                             closeAllTransactionCursors(txId);
>                         } catch (Exception e) {
>                             LOG.warn("Unable to close cursor on primary 
> replica expiration", e);
>                         }
>                     }));{code}
> Tests are trickey though.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to