Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. On TX coordinator failure the oldest node from tx participants is elected as TX coordinator and checks other participants' local states.
  2. If there is at least one participant having tx in ACTIVE or ABORTED state, whole transaction is marked as ABORTED and tx rolled back message is sent to MVCC coordinator.
  3. If there is at least one lost partition from cacheId to partitions mapping, whole transaction is marked as ABORTED and tx rolled back message is sent to MVCC coordinator.
  4. If all participants have tx in LOCALLY_COMMITTED state and there is no lost partitions, whole transaction is marked as COMMITTED and tx committed message is sent to MVCC coordinator.
  5. A record with lost partitions from cacheId to partitions mapping cannot be deleted from TxLog (we cannot cleanup caches with lost partitions).
  6. Rejoining node compares theyr local TxLog and MVCC coordinator's one. 
  7. All partitions from ACTIVE txs have to be forcibly rebalanced. 
  8. All LOCALLY_COMMITTED txs have to be compared to appropriate record from MVCC coordinator's TxLog. 
  9. If there is no matching record, partitions from such txs have to be forcibly rebalanced.
  10. If there is a matching record, tx gets new state from the record.

Read (getAll and SQL

...

)

Each read operation outside active transaction creates a special read only transaction and uses its tx snapshot for versions filtering.

...

During primary indexes scans 'ver' field of tree item is checked, the first passing MVCC filter item is returned, all next versions of row are skipped.

Update (putAll and DML)

Update consist of next steps:

  1. obitain a lock (write current version into 'xid' field)
  2. add a row with new version.
  3. delete aborted versions of row if exist
  4. set xid_max of previous committed row if exist
  5. delete previous committed versions (less or equal to cleanup version of tx snapshot) if exist

Cleanup of old versions