You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladislav Pyatkov (Jira)" <ji...@apache.org> on 2024/01/09 19:39:00 UTC
[jira] [Commented] (IGNITE-17615) Close local cursors on primary replica expiration
[ https://issues.apache.org/jira/browse/IGNITE-17615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17804859#comment-17804859 ]
Vladislav Pyatkov commented on IGNITE-17615:
--------------------------------------------
I also resolved the ticket IGNITE-20933 at this PR, because it is trivial and does not deserve a dedicated check.
> 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
> 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)