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

Re: [PATCH] enable core.fsyncObjectFiles by default

From
Jeff King <peff@peff.net>
Date
Jan 23, 2018, 16:17 UTC
Message-ID
<20180123161738.GC13068@sigill.intra.peff.net>
In-Reply-To
<20180123054553.GA21015@thunk.org>
On Tue, Jan 23, 2018 at 12:45:53AM -0500, Theodore Ts'o wrote:
Show 15 quoted lines
> What I was thinking about instead is that in cases where we know we
> are likely to be creating a large number of loose objects (whether
> they referenced or not), in a world where we will be calling fsync(2)
> after every single loose object being created, pack files start
> looking *way* more efficient.  So in general, if you know you will be
> creating N loose objects, where N is probably around 50 or so, you'll
> want to create a pack instead.
> 
> One of those cases is "repack -A", and in that case the loose objects
> are all going tobe not referenced, so it would be a "cruft pack".  But
> in many other cases where we might be importing from another DCVS,
> which will be another case where doing an fsync(2) after every loose
> object creation (and where I have sometimes seen it create them *all*
> loose, and not use a pack at all), is going to get extremely slow and
> painful.

Ah, I see. I think in the general case of git operations this is hard (because most object writes don't realize the larger operation that they're a part of). But I agree that those two are the low-hanging fruit (imports should already be using fast-import, and "cruft packs" are not too hard an idea to implement).

I agree that a cruft-pack implementation could just be for "repack -A", and does not have to collect otherwise loose objects. I think part of my confusion was that you and I are coming to the idea from different angles: you care about minimizing fsyncs, and I'm interested in stopping the problem where you have too many loose objects after running auto-gc. So I care more about collecting those loose objects for that case.

Show 9 quoted lines
> > So if we pack all the loose objects into a cruft pack, the mtime of the
> > cruft pack becomes the new gauge for "recent". And if we migrate objects
> > from old cruft pack to new cruft pack at each gc, then they'll keep
> > getting their mtimes refreshed, and we'll never drop them.
> 
> Well, I was assuming that gc would be a special case which doesn't the
> mtime of the old cruft pack.  (Or more generally, any time an object
> is gets copied out of the cruft pack, either to a loose object, or to
> another pack, the mtime on the source pack should not be touched.)

Right, that's the "you have multiple cruft packs" idea which has been discussed[1] (each one just hangs around until its mtime expires, and may duplicate objects found elsewhere).

That does end up with one pack per gc, which just punts the "too many loose objects" to "too many packs". But unless the number of gc runs you do is very high compared to the expiration time, we can probably ignore that.

-Peff
[1] https://public-inbox.org/git/20170610080626.sjujpmgkli4muh7h@sigill.intra.peff.net/
Previous: Theodore Ts'oNext: Jeff King
Message 22 of 52 in “enable core.fsyncObjectFiles by default”
  1. enable core.fsyncObjectFiles by defaultChristoph Hellwig, Jan 17, 2018
  2. Junio C HamanoJan 17, 2018
  3. Christoph HellwigJan 17, 2018
  4. Andreas SchwabJan 17, 2018
  5. Matthew WilcoxJan 17, 2018
  6. Christoph HellwigJan 17, 2018
  7. Ævar Arnfjörð BjarmasonJan 17, 2018
  8. Linus TorvaldsJan 17, 2018
  9. Linus TorvaldsJan 17, 2018
  10. Ævar Arnfjörð BjarmasonJan 17, 2018
  11. Linus TorvaldsJan 17, 2018
  12. Theodore Ts'oJan 17, 2018
  13. Linus TorvaldsJan 17, 2018
  14. Christoph HellwigJan 18, 2018
  15. Junio C HamanoJan 19, 2018
  16. Theodore Ts'oJan 20, 2018
  17. Junio C HamanoJan 20, 2018
  18. Ævar Arnfjörð BjarmasonJan 22, 2018
  19. Theodore Ts'oJan 22, 2018
  20. Jeff KingJan 23, 2018
  21. Theodore Ts'oJan 23, 2018
  22. Jeff KingJan 23, 2018
  23. Jeff KingJan 23, 2018
  24. Chris MasonJan 21, 2018
  25. Ævar Arnfjörð BjarmasonSep 17, 2020
  26. 2/2 core.fsyncObjectFiles: make the docs less flippantÆvar Arnfjörð Bjarmason, Sep 17, 2020
  27. Junio C HamanoSep 17, 2020
  28. Johannes SixtSep 17, 2020
  29. Johannes SchindelinOct 8, 2020
  30. Ævar Arnfjörð BjarmasonOct 8, 2020
  31. Junio C HamanoOct 8, 2020
  32. Johannes SchindelinOct 9, 2020
  33. Christoph HellwigSep 17, 2020
  34. Marc BranchaudSep 17, 2020
  35. 0/2 should core.fsyncObjectFiles fsync the dir entry + docsÆvar Arnfjörð Bjarmason, Sep 17, 2020
  36. 1/2 sha1-file: fsync() loose dir entry when core.fsyncObjectFilesÆvar Arnfjörð Bjarmason, Sep 17, 2020
  37. Jeff KingSep 17, 2020
  38. Christoph HellwigSep 17, 2020
  39. Christoph HellwigSep 17, 2020
  40. Jeff KingSep 17, 2020
  41. Christoph HellwigSep 17, 2020
  42. Junio C HamanoSep 17, 2020
  43. Jeff KingSep 17, 2020
  44. Taylor BlauSep 17, 2020
  45. Ævar Arnfjörð BjarmasonSep 22, 2020
  46. Johannes SixtSep 17, 2020
  47. Ævar Arnfjörð BjarmasonSep 22, 2020
  48. Johannes SchindelinNov 19, 2020
  49. Christoph HellwigSep 17, 2020
  50. Junio C HamanoSep 17, 2020
  51. Jeff KingJan 17, 2018
  52. Christoph HellwigJan 17, 2018

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.