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

Implement writeIntentResolution coordinator path

    XMLWordPrintableJSON

Details

    Description

      Motivation

      In order to implement proper handling of a commit partition primary replica change it's required to:

      1. Support local txnStateMap, in order to
      2. Implement writeIntentResolution coordinator path, in order to
      3. Calculate commitTimestamp on txn coordtinator istead of commit partition, where we do it now.

      First item is covered in IGNITE-20033 Given ticket is about second item only. Third one will be covered in a separate ticket.

      Definition of Done

      From the "client" side, it's required to adjust current writeIntentResolution logic by checking local txnStateLocal map.

      • If there's no corresponding transaction in given map - fallback to the commitPartition path.
      • If the state is COMMITED or ABORTED - use given value as writeInentResolution base. Actually, by doing this we will implelent writeIntentResolution local path.
      • If the state is FINISHING - wait for outcome and return response with the result: commit or abort. One of the most nontrivial steps, because of awaiting logic.
      • If the state is PENDING, retrieve txCoordAddr and ask tx coordinator.
        • If tx coordinator is missing or returns null fallback to the commit partition path.

      From the "server" side

      • If the local txn is COMMITED or ABORTED, return the response with the outcome: commit or abort.
      • If the local txn is FINISHING ** (waiting for finish state replication), wait for outcome and return response with the result: commit or abort
        • If the result is to commit, additional timestamp check is required: a commit timestamp must be <= readTs. If the condition is not held, the result is changed to abort.
      • If local txn is PENDING, adjust the txn coordinator node HLC according to readTs to make sure the txn commit timestamp is above the read timestamp. The read timestamp must be installed before txn is started to commit, so commit timestamp is assigned after the read timestamp. This must be achieved by some sort of concurrency control, preferably non-blocking. In this case we must ignore the write intent, so the outcome is to abort.
      • If txn state is not found in a local cache and txn is not active, return NULL.

      Implementation Notes

      Open questions:

      • Which component is responsible for handling TxStateReq?
      • How to await FINISHING state termination?

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h