Skip to content

transactions: Only vote when reftx hook is in prepared state

Patrick Steinhardt requested to merge pks-reftx-dup-votes into master

For each Git reference transaction, the reference-transaction hook is going to be invoked two times: once when it moves into prepared state, meaning all references have now been locked. And then a second time if the transaction was either committed or aborted.

The hook service is getting executed for both of these state transitions, and as a result we perform two transactional votes. While it's not bad in and off itself, it doesn't make a lot of sense as we can only influence Git's transaction in the "prepared" state anyway. As a result, the second vote is essentially useless to us without anything like a three-phase commit and only incurs another roundtrip to Praefect.

This commit thus changes the logic to only perform a transactional vote in case we're moving into "prepared" state.

Merge request reports

Loading