git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] refs/files: use heuristic to decide whether to repack with `--auto`

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 2, 2024, 13:48 UTC
Message-ID
<cover.1725280479.git.ps@pks.im>
Hi,

I recently noticed that `git maintenance run --auto` always ends up repacking loose references. This is because the "files" backend does not yet have any heuristics wired up to decide whether or not packing refs is in order. The consequence is that we always decided to pack them, which is of course quite a waste of time.

This small patch series fixes this by introducing a new heuristic for the "files" backend. The heuristic is rather simple: the bigger the "packed-refs" file, the more loose refs we require before we decide to repack. We have been using this heurisitc successfully for a long time in Gitaly by now.

Thanks!
Patrick
Patrick Steinhardt (2):
  t0601: merge tests for auto-packing of refs
  refs/files: use heuristic to decide whether to repack with `--auto`
 refs/files-backend.c          |  75 +++++++++++++++++++++++++
 refs/packed-backend.c         |  18 ++++++
 refs/packed-backend.h         |   7 +++
 t/t0601-reffiles-pack-refs.sh | 101 ++++++++++++++++++++++++++++------
 4 files changed, 185 insertions(+), 16 deletions(-)
-- 
2.46.0.421.g159f2d50e7.dirty
Next: Patrick Steinhardt
Message 1 of 16 in “refs/files: use heuristic to decide whether to repack with `--auto`”
  1. 0/2 refs/files: use heuristic to decide whether to repack with `--auto`Patrick Steinhardt, Sep 2, 2024
  2. 1/2 t0601: merge tests for auto-packing of refsPatrick Steinhardt, Sep 2, 2024
  3. 2/2 refs/files: use heuristic to decide whether to repack with `--auto`Patrick Steinhardt, Sep 2, 2024
  4. karthik nayakSep 3, 2024
  5. Patrick SteinhardtSep 3, 2024
  6. Junio C HamanoSep 3, 2024
  7. Patrick SteinhardtSep 4, 2024
  8. Junio C HamanoSep 4, 2024
  9. Patrick SteinhardtSep 4, 2024
  10. karthik nayakSep 5, 2024
  11. 0/3 refs/files: use heuristics to decide whether to repack with `--auto`Patrick Steinhardt, Sep 4, 2024
  12. 1/3 wrapper: introduce `log2u()`Patrick Steinhardt, Sep 4, 2024
  13. 2/3 t0601: merge tests for auto-packing of refsPatrick Steinhardt, Sep 4, 2024
  14. 3/3 refs/files: use heuristic to decide whether to repack with `--auto`Patrick Steinhardt, Sep 4, 2024
  15. Junio C HamanoSep 4, 2024
  16. Patrick SteinhardtSep 5, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.