Skip to content

Record reference transaction ordering in Transaction

Sami Hiltunen requested to merge smh-record-refx-tx-ordering into master

TransactionManager is currently verifying references against the main repository. The verification process prepares a reference transaction and considers the verification successful if no errors come up. Preparing a reference transaction in the repository may leave locks if there is a crash while the locks are held. As the verification happens prior to logging the write, there's no record of the fact that locks may have been left in the rpeository. As it is, such locks would be left in the repository, and never cleaned up. This commit runs verifies the references against a snapshot of the target repository. This has few benefits:

  1. The locks target the snapshot. If there is a crash while the locks are held, they'll be removed along with the snapshot when Gitaly restarts.
  2. As the verification process no longer modifies the repository, transactions can take their snapshots concurrently with the reference verification running.
  3. This paves the way for verifying more complex transactions by using multiple reference transactions. This is useful for example when a transaction resolves a directory-file conflict. Such updates can't be done in a single reference transaction.

In future we can also verify transactions and apply log to the repository concurrently as the verification process no longer writes the locks to the repository. This will especially improve throughput with Raft as log entries don't have to be committed one by one anymore.

Merge request reports