Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Docs Required, Release Notes Required
Description
Motivation
It's required to release all acquired locks on transaction finish in a durable way. Such durability consists of two parts:
- Durable unlock within same primary.
- Durable unlock on primary change.
This ticket is about second part only. There's a counterpart ticket for the first part IGNITE-20004
Definition of Done
- All unreleased locks for the transactions that were finished are released in case of primary re-election, including old primary failure and cluster restart.
Implementation Notes
- We may start with adding onPrimaryElected callback.
- Within this callback, it's required to scan `org.apache.ignite.internal.tx.storage.state.TxStateStorage#scan` local TxStateStorage and call `org.apache.ignite.internal.tx.TxManager#cleanup` for all transactions that have false in TxMeta.locksReleased. TxManager#cleanup is an idempotent operation, thus it's safe to run it multiple time, even from different nodes, e.g. old primary and new primary.
- It's required to add locksReleased field to TxMeta with default value false.
- It's required to set locksReleases to true when all cleanup txCleanupReplicaRequest returns successfully. That extra "updateTxnState(locksReleased == true) should be asynchronous.
- Tests will be non-trivial here, because it'll be required to kill old primary after txnStateChanged but before sending cleanup request.
Attachments
Issue Links
- links to