Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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.
Definition of Done
- On primary replica expiration all RW-scoped cursors are closed.
Implementation Notes
1.In `org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#onPrimaryExpired` we release all tx locks
futs.add(allOf(txFuts).whenComplete((unused, throwable) -> releaseTxLocks(txId)));
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
futs.add(allOf(txFuts).whenComplete((unused, throwable) -> releaseTxLocks(txId)));
with
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); } }));
Tests are trickey though.
Attachments
Issue Links
- is related to
-
IGNITE-20055 Durable txCleanupReplicaRequest send from the commit partition
- Resolved
-
IGNITE-20700 Implement durable transaction coordinator finish
- Resolved
- links to