[PATCH v2 0/3] receive-pack: only use visible refs for connectivity check
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 3, 2022, 14:37 UTC
- Message-ID
- <cover.1667485737.git.ps@pks.im>
- In-Reply-To
- <cover.1666967670.git.ps@pks.im>
Hi,
this is the second version of my patch series that tries to improve performance of the connectivity check by only considering preexisting refs as uninteresting that could actually have been advertised to the client.
This version uses the same idea as v1, but it's basically rewritten based on Taylor's idea of adding a `git rev-list --visible-refs=` switch. This fixes two major concerns:
1. The performance regression in repositories is now gone when there
are no hidden refs. Previously, there was a 10% regression in one
specific benchmark that was caused by reading advertised tips
via stdin in git-rev-list(1). 2. It fixes Jeffs concerns around a TOCTOU-style race with very slow
clients. It could in theory happen that a push takes multiple
days. With the previous idea of reusing advertised refs for the
connectivity check, the end result would be that we perform the
check with a set of refs that has been generated when the push
started.The series is structured as following:
- Patch 1 does some preliminary cleanups to de-globalize the set of
parsed hidden refs so that we can use the existing functions
easily for the new `--visible-refs=` option.- Patch 2 adds the new `--visible-refs=` option to git-rev-list(1).
- Patch 3 converts git-receive-pack(1) to use `--visible-refs=`
instead of `--all`.Overall the performance improvement isn't quite as strong as before: we're only 4.5x faster compared to 6.5x in our repo. But I guess that's still a good-enough improvement, doubly so that there are no downsides for repos anymore that ain't got any hidden refs.
Patrick
Patrick Steinhardt (3): refs: get rid of global list of hidden refs revision: add new parameter to specify all visible refs receive-pack: only use visible refs for connectivity check
Documentation/rev-list-options.txt | 15 +++-- builtin/receive-pack.c | 10 ++- builtin/rev-list.c | 1 + builtin/rev-parse.c | 1 + connected.c | 5 +- connected.h | 6 ++ ls-refs.c | 13 ++-- refs.c | 14 ++-- refs.h | 5 +- revision.c | 34 +++++++++- t/t6021-rev-list-visible-refs.sh | 102 +++++++++++++++++++++++++++++ upload-pack.c | 30 +++++---- 12 files changed, 196 insertions(+), 40 deletions(-) create mode 100755 t/t6021-rev-list-visible-refs.sh
-- 2.38.1