Skip to content

hook: Stop transactions on pre-receive hook failure

Patrick Steinhardt requested to merge pks-hook-stop-transaction into master

The pre-receive hook business logic is only executed on primary nodes in order to avoid executing custom hooks and the likes multiple times. Failures of the pre-receive hook e.g. because of a denied access will thus only ever be detected on primaries. While correct, this has unfortunate side effects when transactions come into play. As the primary will not vote on such a transaction, secondaries will wait for quorum and eventually time out as the primary is never going to cast its own vote. While the end result is the same as the transaction has failed, it will raise a misleading error message and cause a delay of 10 seconds.

With our newly grown ability to stop transactions, we can now do better: in case the pre-receive hook declines the push, we can now gracefully stop the transaction. As a result, secondaries will know to abort and not make a big fuzz about it.

Fixes #3104 (closed) Fixes #3094 (closed)

Merge request reports