Skip to content

transactions: Remove voting via pre-receive hook

When we started out to implement the transaction service, Git didn't yet provide an ability to hook into its reference transactions. In order to iterate fast, we thus implemented voting via the pre-receive hook as a first approximation and a test whether the overall idea of transactional voting actually works. Starting with Git v2.28.0, we now got a mechanism to hook into Git's reference transactions via the reference-transaction hook.

This new hook allows us to perform a vote on each change of a reference and also to abort any ongoing transaction, which thus allows much wider coverage of mutating calls to Git compared to the previous pre-receive implementation. The reference-transaction hook has been battle-tested in production now, which allows us to get rid of voting via the pre-receive hook.

The removal of pre-receive voting should also address some issues we've been seeing around hooks. As only the primary will verify authorization of pushes and execute custom hooks, it would abort before performing a vote while any secondary would nicely chug along and wait for the primary to arrive, as they didn't abort early due to not executing that logic. As a result, secondaries would hang until they hit the RPC's timeout in case the hook logic refused a push. This issue should now go away with all voting logic moving into the reference-transaction hook.

Edited by Patrick Steinhardt

Merge request reports

Loading