You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexander Lapin (Jira)" <ji...@apache.org> on 2023/12/29 12:30:00 UTC

[jira] [Updated] (IGNITE-17615) Close local cursors on primary replica expiration

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

Alexander Lapin updated IGNITE-17615:
-------------------------------------
    Summary: Close local cursors on primary replica expiration  (was: Handling primary replica changes on TxFinishReplicaRequest  and TxCleanupReplicaRequest)

> 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
>            Priority: Major
>              Labels: ignite-3
>
> 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`



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