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

Re: [PATCH] gc: support temporarily preserving garbage

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 14, 2014, 23:01 UTC
Message-ID
<xmqqlhnd1j66.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1415927805-53644-1-git-send-email-brodie@sf.io>
Brodie Rao <brodie@sf.io> writes:
Show 43 quoted lines
> This patch adds a gc.garbageexpire setting that, when not set to "now",
> makes gc (and prune, prune-packed, and repack) move garbage into a
> temporary garbage directory instead of deleting it immediately. The
> garbage directory is then cleared out based on gc.garbageexpire.
>
> The motivation for this setting is to work around various NFS servers
> not supporting delete-on-last-close semantics between NFS clients.
> Without proper support for that, gc could potentially delete objects
> and packs that are in use by git processes on other NFS clients. If
> another git process has a deleted pack file mmap()ed, it could crash
> with a SIGBUS error on Linux.
>
> Signed-off-by: Brodie Rao <brodie@sf.io>
> ---
>  .gitignore                             |  1 +
>  Documentation/config.txt               | 20 +++++++++
>  Documentation/git-gc.txt               |  7 ++++
>  Documentation/git-prune-garbage.txt    | 55 ++++++++++++++++++++++++
>  Documentation/git-prune-packed.txt     |  9 ++++
>  Documentation/git-prune.txt            |  9 ++++
>  Documentation/git-repack.txt           |  6 +++
>  Documentation/git.txt                  |  6 +++
>  Makefile                               |  2 +
>  builtin.h                              |  1 +
>  builtin/gc.c                           | 20 +++++++++
>  builtin/prune-garbage.c                | 77 ++++++++++++++++++++++++++++++++++
>  builtin/prune-packed.c                 |  3 +-
>  builtin/prune.c                        |  5 ++-
>  builtin/repack.c                       |  7 ++--
>  cache.h                                |  2 +
>  command-list.txt                       |  1 +
>  contrib/completion/git-completion.bash |  2 +
>  environment.c                          | 12 +++++-
>  gc.c                                   | 60 ++++++++++++++++++++++++++
>  gc.h                                   | 16 +++++++
>  git.c                                  |  1 +
>  t/t6502-gc-garbage-expire.sh           | 60 ++++++++++++++++++++++++++
>  23 files changed, 375 insertions(+), 7 deletions(-)
>  create mode 100644 Documentation/git-prune-garbage.txt
>  create mode 100644 builtin/prune-garbage.c
>  create mode 100644 gc.c
>  create mode 100644 gc.h
>  create mode 100755 t/t6502-gc-garbage-expire.sh

I am not sure if this much of code churn is warranted to work around issues that only happen on repositories on NFS servers that do not keep open-but-deleted files available. Is it an option to instead have a copy of repository locally off NFS?

Previous: Brodie RaoNext: Stefan Saasen
Message 2 of 10 in “gc: support temporarily preserving garbage”
  1. gc: support temporarily preserving garbageBrodie Rao, Nov 14, 2014
  2. Junio C HamanoNov 14, 2014
  3. Stefan SaasenNov 15, 2014
  4. Jeff KingNov 17, 2014
  5. Stefan SaasenNov 17, 2014
  6. Jeff KingNov 18, 2014
  7. Brodie RaoDec 3, 2014
  8. Jeff KingDec 4, 2014
  9. Junio C HamanoDec 4, 2014
  10. Jeff KingDec 5, 2014

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.