Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-17578

Transactions: async cleanup processing on tx commit

    XMLWordPrintableJSON

Details

    Description

      Motivation

      Within RW transaction commit process, according to the tx design it's required to return the control to the outer logic right after

      1. COMMITED/ABORTED txn state replication
      2. Locks release.

      Follow-up cleanup process, that will apply or remove write intents, should be asynchronous. Currently, it's not true.  It also worth to mention that currently, locks are released after write intent application. That should be inverted. Such enhancements mean that not only RO but also RW transactions may retrieve writeIntent and thus perform writeInentResolution - it's covered with separate ticket https://issues.apache.org/jira/browse/IGNITE-19570 that should be implemented prior to this one.

      Definition of Done

      • Write intent application or removal should be implemented in an async format.
      • Write intent application and locks release process should be inverted.

      Implementation Notes

      Generally it's only required to change some code in org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener#processTxCleanupAction

          return allOffFuturesExceptionIgnored(txUpdateFutures, request).thenCompose(v -> {
              TxCleanupCommand txCleanupCmd = MSG_FACTORY.txCleanupCommand()
                      .txId(request.txId())
                      .commit(request.commit())
                      .commitTimestampLong(request.commitTimestampLong())
                      .safeTimeLong(hybridClock.nowLong())
                      .build();
      
              return raftClient
                      .run(txCleanupCmd)
                      .thenCompose(ignored -> allOffFuturesExceptionIgnored(txReadFutures, request)
                              .thenRun(() -> releaseTxLocks(request.txId())));
          });
      } 
      • releaseTxLocks priour to sending txCleanupCmd.
      • send txCleanupCmd in async manner, meaning that processTxCleanupAction should return the result after locks are released.

      It seems that durable writeIntentApplication, the process that is triggered by sending txCleanupCmd will be durable because of raftClient inner implementation, apparently new topologyAwareRaftClient and special recovery procedures on primary re-election that will be covered by separate ticket, so nothing to do here.

      Attachments

        Issue Links

          Activity

            People

              Denis Chudov Denis Chudov
              alapin Alexander Lapin
              Alexander Lapin Alexander Lapin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: