Skip to content

Relabel smarthttp.InfoRefsReceivePack as accessor

Patrick Steinhardt requested to merge pks-inforefs-accessor into master

The smarthttp.InfoRefsReceivePack RPC is currently labelled as mutator. Taking a closer look at it, there is no way it can change any objects in the repo though, as it will always either spawn git receive-pack --stateless-rpc --advertise-refs or git upload-pack --stateless-rpc --advertise-refs. While git-receive-pack(1) may modify the repo, it won't ever do so with the --advertise-refs flag, as it will cause the command to only advertise references and then exit immediately afterwards.

As the RPC is called in quick succession with smarthttp.PostUploadPack in case a user performs a push, the first call to InfoRefs would've increased the repository generation and caused replication jobs to be created. As a result, when PostUploadPack gets invoked it is likely that secondaries will be treated as out-of-date as replication jobs usually weren't processed yet. This in turn breaks transactions, as we will now only add the primary to any transaction for all pushes via smarthttp.

So let's relabel the RPC as an accessor to avoid replication when it's called and fix the described issue.

Fixes #3007 (closed)

Edited by Patrick Steinhardt

Merge request reports