git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: David Turner <novalis@novalis.org>, Han-Wen Nienhuys <hanwen@google.com>
Subject: [PATCH 0/4] refs: remove virtual `delete_refs()` function
Date: Tue, 14 Nov 2023 09:58:34 +0100	[thread overview]
Message-ID: <cover.1699951815.git.ps@pks.im> (raw)

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

Hi,

this patch series refactors the virtual `delete_refs()` function to
instead be implemented generically via a single reference transaction.

The main intent of this patch series is to reduce complexity that we
have in the reference backends so that it becomes easier to implement
new backends that have the same semantics as others. But at the same
time, benchmarks show that the new generic code is even faster than the
old backend-specific code. This is mostly because we avoid the overhead
of per-reference transactions when deleting many references, but also
because the transactional code in the files backend knows to avoid
rewriting the packed-refs file in case it contains none of the refs that
are to be deleted.

So in the end we have less duplicate code in the files backend, make it
easier to implement new backends, and have faster deletion of many refs
in the files backend.

Patrick

Patrick Steinhardt (4):
  t5510: ensure that the packed-refs file needs locking
  refs/files: use transactions to delete references
  refs: deduplicate code to delete references
  refs: remove `delete_refs` callback from backends

 refs.c                | 48 ++++++++++++++++++++++++++++++++++++++---
 refs/debug.c          | 15 -------------
 refs/files-backend.c  | 49 ------------------------------------------
 refs/packed-backend.c | 50 -------------------------------------------
 refs/refs-internal.h  |  3 ---
 t/t5510-fetch.sh      |  1 +
 6 files changed, 46 insertions(+), 120 deletions(-)


base-commit: e0939bec273052b1a8d69db4a3f7c87aaf83e220
-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2023-11-14  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14  8:58 Patrick Steinhardt [this message]
2023-11-14  8:58 ` [PATCH 1/4] t5510: ensure that the packed-refs file needs locking Patrick Steinhardt
2023-11-14  8:58 ` [PATCH 2/4] refs/files: use transactions to delete references Patrick Steinhardt
2023-11-14  8:58 ` [PATCH 3/4] refs: deduplicate code " Patrick Steinhardt
2023-11-14  8:58 ` [PATCH 4/4] refs: remove `delete_refs` callback from backends Patrick Steinhardt

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1699951815.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    --cc=novalis@novalis.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.
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 NNTP newsgroup(s).