From: Karthik Nayak <karthik.188@gmail.com>
To: git@vger.kernel.org
Cc: Karthik Nayak <karthik.188@gmail.com>
Subject: [PATCH 0/9] refs: add a '--required' flag to 'git refs optimize'
Date: Fri, 10 Oct 2025 12:27:04 +0200 [thread overview]
Message-ID: <20251010-562-add-option-to-check-if-reference-backend-needs-repacking-v1-0-c7962be584fa@gmail.com> (raw)
At GitLab, we use a transaction manager in Gitaly (our service layer on
top of Git) to manage incoming requests. This provides snapshotting
capabilities and provides ACID properties. To optimize for performance,
read snapshots are shared. This means they are cheaper to initiate than
write snapshots. However, housekeeping requires a write snapshot.
Currently, we run housekeeping in write snapshots which includes
optimizing references. If Git exposed information regarding if
optimization was required, then we could spawn a read snapshot to check
if optimization was required and only spawn a write snapshot if needed.
This patch series adds a '--required' flag to 'git refs optimize' which
will indicate if optimization is required for the reference backend or
not.
The series is structured as follows:
Patches 1-4 are mostly cleanup patches, cleaning up existing code post
the addition of 'git refs optimize'. Some of them could be potentially
dropped.
Patch 5 fixes the test which checks for inconsisten leading whitespaces
in our documentation for builtin commands to also consider subcommands.
Patches 6-8 are preliminary patches which add the required changes to
provide a functionality which only checks if optimization is required
without running it.
Patch 9 adds the '--required' flag.
The series is based on top of 60f3f52f17 (The sixteenth batch,
2025-10-08) with 'ps/ref-peeled-tags' merged in.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
Documentation/git-pack-refs.adoc | 1 +
Documentation/git-refs.adoc | 1 +
Documentation/pack-refs-options.adoc | 5 +++++
builtin/pack-refs.c | 2 +-
builtin/refs.c | 2 +-
pack-refs.c | 19 ++++++++++++-----
pack-refs.h | 10 +++++++--
refs.c | 11 +++++-----
refs.h | 31 +++++++++++++++------------
refs/debug.c | 21 ++++++++++++++----
refs/files-backend.c | 27 ++++++++++++------------
refs/packed-backend.c | 19 ++++++++++++++---
refs/refs-internal.h | 11 ++++++----
refs/reftable-backend.c | 34 +++++++++++++++++++++++-------
reftable/reftable-stack.h | 3 +++
reftable/stack.c | 41 ++++++++++++++++++++++++++----------
t/pack-refs-tests.sh | 21 +++++++++++++++++-
t/t0450-txt-doc-vs-help.sh | 28 +++++++++++++-----------
t/t0601-reffiles-pack-refs.sh | 2 ++
t/t1463-refs-optimize.sh | 2 ++
t/unit-tests/u-reftable-stack.c | 12 +++++++++--
21 files changed, 217 insertions(+), 86 deletions(-)
Karthik Nayak (9):
refs: move to using the '.optimize' functions
refs: cleanup code around optimization
refs: rename 'pack_refs_opts' to 'optimize_refs_opts'
t/pack-refs-tests: move the 'test_done' to callees
t/t0450: split whitespace consistency check per subcommand
reftable/stack: return stack segments directly
reftable/stack: add function to check if optimization is required
refs: add a `optimize_required` field to `struct ref_storage_be`
refs: add a '--required' flag to 'git refs optimize'
base-commit: 9081ca56692a28ce89a49537e6c568b3ccdef405
change-id: 20250926-562-add-option-to-check-if-reference-backend-needs-repacking-aa600eb3e055
Thanks
- Karthik
next reply other threads:[~2025-10-10 10:27 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-10 10:27 Karthik Nayak [this message]
2025-10-10 10:27 ` [PATCH 1/9] refs: move to using the '.optimize' functions Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 8:18 ` Karthik Nayak
2025-10-10 10:27 ` [PATCH 2/9] refs: cleanup code around optimization Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 8:22 ` Karthik Nayak
2025-10-10 10:27 ` [PATCH 3/9] refs: rename 'pack_refs_opts' to 'optimize_refs_opts' Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 8:52 ` Karthik Nayak
2025-10-10 10:27 ` [PATCH 4/9] t/pack-refs-tests: move the 'test_done' to callees Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 8:54 ` Karthik Nayak
2025-10-10 10:27 ` [PATCH 5/9] t/t0450: split whitespace consistency check per subcommand Karthik Nayak
2025-10-10 10:27 ` [PATCH 6/9] reftable/stack: return stack segments directly Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 9:01 ` Karthik Nayak
2025-10-13 11:10 ` Patrick Steinhardt
2025-10-10 10:27 ` [PATCH 7/9] reftable/stack: add function to check if optimization is required Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 9:04 ` Karthik Nayak
2025-10-10 10:27 ` [PATCH 8/9] refs: add a `optimize_required` field to `struct ref_storage_be` Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 9:46 ` Karthik Nayak
2025-10-10 10:27 ` [PATCH 9/9] refs: add a '--required' flag to 'git refs optimize' Karthik Nayak
2025-10-10 11:22 ` Patrick Steinhardt
2025-10-13 12:37 ` Karthik Nayak
2025-10-13 13:40 ` Junio C Hamano
2025-10-13 14:37 ` Junio C Hamano
2025-10-14 15:08 ` Karthik Nayak
2025-10-14 17:46 ` Junio C Hamano
2025-10-15 7:50 ` Srivastava, Nitin
2025-10-15 8:19 ` Karthik Nayak
2025-10-15 9:29 ` Karthik Nayak
2025-10-15 12:14 ` Patrick Steinhardt
2025-10-15 20:17 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251010-562-add-option-to-check-if-reference-backend-needs-repacking-v1-0-c7962be584fa@gmail.com \
--to=karthik.188@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).