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

Re: [PATCH v3 01/17] Documentation/technical: add cruft-packs.txt

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 22, 2022, 23:04 UTC
Message-ID
<YjpWFZ95OL7joFa4@google.com>
In-Reply-To
<YjpHbaBspUasDdEy@nand.local>
Hi,
Taylor Blau wrote:
> On Tue, Mar 22, 2022 at 02:45:16PM -0700, Jonathan Nieder wrote:
Show 5 quoted lines
>> Great.  Can the doc cover this?  I think it would be helpful to make
>> that easy to find for others with similar questions.
>
> I believe the doc covers this already, see the paragraph beginning with
> "Unreachable objects aren't removed immediately...".

Thanks. I just reread that section and it didn't say anything obvious about the race that continues to exist and whether cruft packs address it.

[...]
Show 9 quoted lines
>> Sorry, the above seems like it's answering a different question than I
>> asked.  The doc in Documentation/technical/ seems like a natural place
>> to describe what semantics the new .mtimes file has, and I didn't find
>> that there.  Is there a different piece of documentation I should have
>> been looking at?
>
> Are you looking for a technical description of the mtimes file? If so,
> there is a section in Documentation/technical/pack-format.txt (added in
> "pack-mtimes: support reading .mtimes files") that explains this.

I see --- is the idea that cruft-packs.txt means to refer to pack-format.txt for the details, and cruft-packs is an overview of some other, non-detail aspects?

I just checked pack-format.txt and it didn't describe the semantics (what a Git implementation is expected to do when it sees an mtimes file). For example, in Documentation/technical/cruft-packs.txt, the kind of thing I'd expect to see is

- what does an mtime value in the mtimes file represent?  When is it
  meant to be updated?
- what guarantees are present about when an object is safe to be
  pruned?
[...]
Show 10 quoted lines
>> Can you tell me a little more about why we would want _not_ to have a
>> repository format extension?  To me, it seems like a fairly simple
>> addition that would drastically reduce the cognitive overload for
>> people considering making use of this feature.
>
>There is no reason to prevent a pre-cruft packs version of Git from
> reading/writing a repository that uses cruft packs, since the two
> versions will still function as normal. Since there's no need to prevent
> the old version from interacting with a repository that has cruft packs,
> we wouldn't want to enforce an unnecessary boundary with an extension.

Does "function as normal" include in repository maintenance operations like "git maintenance", "git gc", and "git prune"? If so, this seems like something very useful to describe in the cruft-packs.txt document, since what happens when we bounce back and forth between old and new versions of Git operating on the same NFS mounted repository would not be obvious without such a discussion.

I'm still interested in the _downsides_ of using a repository format extension. "There is no reason" is not a downside, unless you mean that it requires adding a line of code. :) The main downside I can imagine is that it prevents accessing the repository _that has enabled this feature_ with an older version of Git, but I (perhaps due to a failure of imagination) haven't put two and two together yet about when I would want to do so.

[...]
Show 12 quoted lines
> Expiring objects in piecemeal is somewhat interesting, but I think I was
> reaching a little too far when I said it was the "key benefit". It does
> have some nice properties, like being able to store cruft objects as
> deltas against other cruft objects which might get pruned at a different
> time (though, of course, you'll need to re-delta them in the case you do
> prune an object which is the base of another cruft object).
>
> But the issue with having multiple cruft packs is that the semantics get
> significantly more complicated. E.g., if you have an object represented
> in multiple cruft packs, which mtime do you use? If you want to prune
> it, you suddenly may have many packs you need to update and keep track
> of.
Thanks for this explanation.  In hash-function-transition.txt, I see
	"git gc" currently expels any unreachable objects it encounters in
	pack files to loose objects in an attempt to prevent a race when
	pruning them (in case another process is simultaneously writing a new
	object that refers to the about-to-be-deleted object). This leads to
	an explosion in the number of loose objects present and disk space
	usage due to the objects in delta form being replaced with independent
	loose objects.  Worse, the race is still present for loose objects.
	Instead, "git gc" will need to move unreachable objects to a new
	packfile marked as UNREACHABLE_GARBAGE (using the PSRC field; see
	below). To avoid the race when writing new objects referring to an
	about-to-be-deleted object, code paths that write new objects will
	need to copy any objects from UNREACHABLE_GARBAGE packs that they
	refer to new, non-UNREACHABLE_GARBAGE packs (or loose objects).
	UNREACHABLE_GARBAGE are then safe to delete if their creation time (as
	indicated by the file's mtime) is long enough ago.
	To avoid a proliferation of UNREACHABLE_GARBAGE packs, they can be
	combined under certain circumstances. [etc]

So the proposal there is that the file mtime for an UNREACHABLE_GARBAGE pack refers to when that pack was written and governs when that pack can be deleted. If an object is present in multiple packs, then newer packs with the object have a newer mtime and thus cause the object to be kept around for longer.

[...]
Show 13 quoted lines
>> Sorry, I don't understand this answer either.  Do you mean to say that
>> JGit's DfsRepository does not in fact have a cruft packs like feature
>> that is live in the wild?  Or that that feature is equivalent to not
>> having such a feature?  Or something else?
>>
>> To be clear, I'm not trying to say that that's superior to what you've
>> proposed here --- only that documenting the comparison would be
>> useful.
>
> I'm not familiar enough with JGit (or its DfsRepository class) to know
> how to answer this. I was comparing cruft packs to the
> UNREACHABLE_GARBAGE concept mentioned in the hash-function-transition
> doc, and noting the differences there.

Thanks. I think there's some implied feedback about the documentation of UNREACHABLE_GARBAGE there, because if I understand then you're saying that it does not describe maintaining cruft packs. Perhaps a pointer to the particular sentence that led you to that conclusion would help.

Sincerely, Jonathan

Previous: Taylor BlauNext: Taylor Blau
Message 80 of 201 in “cruft packs”
  1. 00/17 cruft packsTaylor Blau, Nov 29, 2021
  2. 01/17 Documentation/technical: add cruft-packs.txtTaylor Blau, Nov 29, 2021
  3. Derrick StoleeDec 2, 2021
  4. Taylor BlauDec 3, 2021
  5. Elijah NewrenDec 4, 2021
  6. Taylor BlauDec 4, 2021
  7. 02/17 pack-mtimes: support reading .mtimes filesTaylor Blau, Nov 29, 2021
  8. Derrick StoleeDec 2, 2021
  9. brian m. carlsonDec 2, 2021
  10. Taylor BlauDec 3, 2021
  11. Taylor BlauJan 7, 2022
  12. 04/17 chunk-format.h: extract oid_version()Taylor Blau, Nov 29, 2021
  13. Derrick StoleeDec 2, 2021
  14. Taylor BlauDec 3, 2021
  15. Derrick StoleeDec 6, 2021
  16. 03/17 pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles'Taylor Blau, Nov 29, 2021
  17. 05/17 pack-mtimes: support writing pack .mtimes filesTaylor Blau, Nov 29, 2021
  18. Derrick StoleeDec 2, 2021
  19. Taylor BlauDec 3, 2021
  20. 09/17 reachable: add options to add_unseen_recent_objects_to_traversalTaylor Blau, Nov 29, 2021
  21. 13/17 builtin/repack.c: allow configuring cruft pack generationTaylor Blau, Nov 29, 2021
  22. 06/17 t/helper: add 'pack-mtimes' test-toolTaylor Blau, Nov 29, 2021
  23. Derrick StoleeDec 6, 2021
  24. Taylor BlauFeb 23, 2022
  25. 11/17 builtin/pack-objects.c: --cruft with expirationTaylor Blau, Nov 29, 2021
  26. Derrick StoleeDec 7, 2021
  27. Taylor BlauFeb 23, 2022
  28. 10/17 reachable: report precise timestamps from objects in cruft packsTaylor Blau, Nov 29, 2021
  29. 07/17 builtin/pack-objects.c: return from create_object_entry()Taylor Blau, Nov 29, 2021
  30. 08/17 builtin/pack-objects.c: --cruft without expirationTaylor Blau, Nov 29, 2021
  31. Derrick StoleeDec 6, 2021
  32. Taylor BlauMar 1, 2022
  33. Derrick StoleeDec 7, 2021
  34. Taylor BlauFeb 23, 2022
  35. 12/17 builtin/repack.c: support generating a cruft packTaylor Blau, Nov 29, 2021
  36. Junio C HamanoDec 5, 2021
  37. Taylor BlauMar 1, 2022
  38. Derrick StoleeDec 7, 2021
  39. Taylor BlauFeb 23, 2022
  40. 15/17 builtin/repack.c: add cruft packs to MIDX during geometric repackTaylor Blau, Nov 29, 2021
  41. 16/17 builtin/gc.c: conditionally avoid pruning objects via looseTaylor Blau, Nov 29, 2021
  42. 17/17 sha1-file.c: don't freshen cruft packsTaylor Blau, Nov 29, 2021
  43. 14/17 builtin/repack.c: use named flags for existing_packsTaylor Blau, Nov 29, 2021
  44. Junio C HamanoDec 3, 2021
  45. Taylor BlauDec 3, 2021
  46. Taylor BlauDec 3, 2021
  47. 00/17 cruft packsTaylor Blau, Mar 2, 2022
  48. 01/17 Documentation/technical: add cruft-packs.txtTaylor Blau, Mar 2, 2022
  49. 03/17 pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles'Taylor Blau, Mar 2, 2022
  50. 02/17 pack-mtimes: support reading .mtimes filesTaylor Blau, Mar 2, 2022
  51. Derrick StoleeMar 2, 2022
  52. Taylor BlauMar 2, 2022
  53. 04/17 chunk-format.h: extract oid_version()Taylor Blau, Mar 2, 2022
  54. 06/17 t/helper: add 'pack-mtimes' test-toolTaylor Blau, Mar 2, 2022
  55. 05/17 pack-mtimes: support writing pack .mtimes filesTaylor Blau, Mar 2, 2022
  56. 07/17 builtin/pack-objects.c: return from create_object_entry()Taylor Blau, Mar 2, 2022
  57. 08/17 builtin/pack-objects.c: --cruft without expirationTaylor Blau, Mar 2, 2022
  58. 09/17 reachable: add options to add_unseen_recent_objects_to_traversalTaylor Blau, Mar 2, 2022
  59. Derrick StoleeMar 2, 2022
  60. Taylor BlauMar 2, 2022
  61. 11/17 builtin/pack-objects.c: --cruft with expirationTaylor Blau, Mar 2, 2022
  62. Junio C HamanoMar 2, 2022
  63. Taylor BlauMar 2, 2022
  64. Derrick StoleeMar 2, 2022
  65. 10/17 reachable: report precise timestamps from objects in cruft packsTaylor Blau, Mar 2, 2022
  66. 13/17 builtin/repack.c: allow configuring cruft pack generationTaylor Blau, Mar 2, 2022
  67. 12/17 builtin/repack.c: support generating a cruft packTaylor Blau, Mar 2, 2022
  68. 14/17 builtin/repack.c: use named flags for existing_packsTaylor Blau, Mar 2, 2022
  69. 15/17 builtin/repack.c: add cruft packs to MIDX during geometric repackTaylor Blau, Mar 2, 2022
  70. 16/17 builtin/gc.c: conditionally avoid pruning objects via looseTaylor Blau, Mar 2, 2022
  71. 17/17 sha1-file.c: don't freshen cruft packsTaylor Blau, Mar 2, 2022
  72. Derrick StoleeMar 2, 2022
  73. Taylor BlauMar 2, 2022
  74. 00/17 cruft packsTaylor Blau, Mar 3, 2022
  75. 01/17 Documentation/technical: add cruft-packs.txtTaylor Blau, Mar 3, 2022
  76. Jonathan NiederMar 7, 2022
  77. Taylor BlauMar 22, 2022
  78. Jonathan NiederMar 22, 2022
  79. Taylor BlauMar 22, 2022
  80. Jonathan NiederMar 22, 2022
  81. Taylor BlauMar 23, 2022
  82. Taylor BlauMar 28, 2022
  83. Junio C HamanoMar 28, 2022
  84. Taylor BlauMar 28, 2022
  85. Junio C HamanoMar 29, 2022
  86. Taylor BlauMar 30, 2022
  87. Junio C HamanoMar 30, 2022
  88. Taylor BlauMar 30, 2022
  89. 03/17 pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles'Taylor Blau, Mar 3, 2022
  90. 02/17 pack-mtimes: support reading .mtimes filesTaylor Blau, Mar 3, 2022
  91. 04/17 chunk-format.h: extract oid_version()Taylor Blau, Mar 3, 2022
  92. Ævar Arnfjörð BjarmasonMar 3, 2022
  93. Taylor BlauMar 3, 2022
  94. Junio C HamanoMar 4, 2022
  95. 05/17 pack-mtimes: support writing pack .mtimes filesTaylor Blau, Mar 3, 2022
  96. Ævar Arnfjörð BjarmasonMar 3, 2022
  97. Taylor BlauMar 3, 2022
  98. Ævar Arnfjörð BjarmasonMar 4, 2022
  99. 06/17 t/helper: add 'pack-mtimes' test-toolTaylor Blau, Mar 3, 2022
  100. 07/17 builtin/pack-objects.c: return from create_object_entry()Taylor Blau, Mar 3, 2022
  101. 08/17 builtin/pack-objects.c: --cruft without expirationTaylor Blau, Mar 3, 2022
  102. 09/17 reachable: add options to add_unseen_recent_objects_to_traversalTaylor Blau, Mar 3, 2022
  103. 10/17 reachable: report precise timestamps from objects in cruft packsTaylor Blau, Mar 3, 2022
  104. 11/17 builtin/pack-objects.c: --cruft with expirationTaylor Blau, Mar 3, 2022
  105. 12/17 builtin/repack.c: support generating a cruft packTaylor Blau, Mar 3, 2022
  106. 13/17 builtin/repack.c: allow configuring cruft pack generationTaylor Blau, Mar 3, 2022
  107. 14/17 builtin/repack.c: use named flags for existing_packsTaylor Blau, Mar 3, 2022
  108. 16/17 builtin/gc.c: conditionally avoid pruning objects via looseTaylor Blau, Mar 3, 2022
  109. 17/17 sha1-file.c: don't freshen cruft packsTaylor Blau, Mar 3, 2022
  110. 15/17 builtin/repack.c: add cruft packs to MIDX during geometric repackTaylor Blau, Mar 3, 2022
  111. Derrick StoleeMar 3, 2022
  112. 00/17 cruft packsTaylor Blau, May 18, 2022
  113. 01/17 Documentation/technical: add cruft-packs.txtTaylor Blau, May 18, 2022
  114. Junio C HamanoMay 19, 2022
  115. 02/17 pack-mtimes: support reading .mtimes filesTaylor Blau, May 18, 2022
  116. Ævar Arnfjörð BjarmasonMay 19, 2022
  117. Junio C HamanoMay 19, 2022
  118. Ævar Arnfjörð BjarmasonMay 20, 2022
  119. Taylor BlauMay 20, 2022
  120. 03/17 pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles'Taylor Blau, May 18, 2022
  121. 06/17 t/helper: add 'pack-mtimes' test-toolTaylor Blau, May 18, 2022
  122. 07/17 builtin/pack-objects.c: return from create_object_entry()Taylor Blau, May 18, 2022
  123. 10/17 reachable: report precise timestamps from objects in cruft packsTaylor Blau, May 18, 2022
  124. 09/17 reachable: add options to add_unseen_recent_objects_to_traversalTaylor Blau, May 18, 2022
  125. 08/17 builtin/pack-objects.c: --cruft without expirationTaylor Blau, May 18, 2022
  126. Junio C HamanoMay 19, 2022
  127. Junio C HamanoMay 19, 2022
  128. Taylor BlauMay 20, 2022
  129. 11/17 builtin/pack-objects.c: --cruft with expirationTaylor Blau, May 18, 2022
  130. 12/17 builtin/repack.c: support generating a cruft packTaylor Blau, May 18, 2022
  131. Ævar Arnfjörð BjarmasonMay 19, 2022
  132. Taylor BlauMay 20, 2022
  133. 04/17 chunk-format.h: extract oid_version()Taylor Blau, May 18, 2022
  134. Ævar Arnfjörð BjarmasonMay 19, 2022
  135. 05/17 pack-mtimes: support writing pack .mtimes filesTaylor Blau, May 18, 2022
  136. 13/17 builtin/repack.c: allow configuring cruft pack generationTaylor Blau, May 18, 2022
  137. 14/17 builtin/repack.c: use named flags for existing_packsTaylor Blau, May 18, 2022
  138. 15/17 builtin/repack.c: add cruft packs to MIDX during geometric repackTaylor Blau, May 18, 2022
  139. Ævar Arnfjörð BjarmasonMay 19, 2022
  140. Taylor BlauMay 20, 2022
  141. 16/17 builtin/gc.c: conditionally avoid pruning objects via looseTaylor Blau, May 18, 2022
  142. 17/17 sha1-file.c: don't freshen cruft packsTaylor Blau, May 18, 2022
  143. Derrick StoleeMay 18, 2022
  144. Junio C HamanoMay 20, 2022
  145. Taylor BlauMay 20, 2022
  146. 0/2 Utility functions for duplicated pack(write) codeÆvar Arnfjörð Bjarmason, May 19, 2022
  147. 1/2 packfile API: add and use a pack_name_to_ext() utility functionÆvar Arnfjörð Bjarmason, May 19, 2022
  148. Junio C HamanoMay 19, 2022
  149. 2/2 hash API: add and use a hash_short_id_by_algo() functionÆvar Arnfjörð Bjarmason, May 19, 2022
  150. Junio C HamanoMay 19, 2022
  151. Ævar Arnfjörð BjarmasonMay 19, 2022
  152. Junio C HamanoMay 19, 2022
  153. Ævar Arnfjörð BjarmasonMay 19, 2022
  154. 00/17 cruft packsTaylor Blau, May 20, 2022
  155. 01/17 Documentation/technical: add cruft-packs.txtTaylor Blau, May 20, 2022
  156. 05/17 pack-mtimes: support writing pack .mtimes filesTaylor Blau, May 20, 2022
  157. 04/17 chunk-format.h: extract oid_version()Taylor Blau, May 20, 2022
  158. 03/17 pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles'Taylor Blau, May 20, 2022
  159. 06/17 t/helper: add 'pack-mtimes' test-toolTaylor Blau, May 20, 2022
  160. 07/17 builtin/pack-objects.c: return from create_object_entry()Taylor Blau, May 20, 2022
  161. 02/17 pack-mtimes: support reading .mtimes filesTaylor Blau, May 20, 2022
  162. Jonathan NiederMay 24, 2022
  163. rsbecker@nexbridge.comMay 24, 2022
  164. Taylor BlauMay 24, 2022
  165. rsbecker@nexbridge.comMay 24, 2022
  166. Taylor BlauMay 25, 2022
  167. rsbecker@nexbridge.comMay 25, 2022
  168. adding new 32-bit on-disk (unsigned) timestamp formats (was: [PATCH v5 02/17] pack-mtimes: support reading .mtimes files)Ævar Arnfjörð Bjarmason, May 25, 2022
  169. Derrick StoleeMay 25, 2022
  170. Taylor BlauMay 25, 2022
  171. Ævar Arnfjörð BjarmasonMay 26, 2022
  172. Taylor BlauMay 26, 2022
  173. Taylor BlauMay 24, 2022
  174. Jonathan NiederMay 25, 2022
  175. Taylor BlauMay 25, 2022
  176. rsbecker@nexbridge.comMay 25, 2022
  177. Taylor BlauMay 25, 2022
  178. Taylor BlauMay 25, 2022
  179. Junio C HamanoMay 26, 2022
  180. Andreas SchwabJun 1, 2023
  181. 08/17 builtin/pack-objects.c: --cruft without expirationTaylor Blau, May 20, 2022
  182. 10/17 reachable: report precise timestamps from objects in cruft packsTaylor Blau, May 20, 2022
  183. 09/17 reachable: add options to add_unseen_recent_objects_to_traversalTaylor Blau, May 20, 2022
  184. 11/17 builtin/pack-objects.c: --cruft with expirationTaylor Blau, May 20, 2022
  185. 12/17 builtin/repack.c: support generating a cruft packTaylor Blau, May 20, 2022
  186. 13/17 builtin/repack.c: allow configuring cruft pack generationTaylor Blau, May 20, 2022
  187. 15/17 builtin/repack.c: add cruft packs to MIDX during geometric repackTaylor Blau, May 20, 2022
  188. 14/17 builtin/repack.c: use named flags for existing_packsTaylor Blau, May 20, 2022
  189. 17/17 sha1-file.c: don't freshen cruft packsTaylor Blau, May 20, 2022
  190. 16/17 builtin/gc.c: conditionally avoid pruning objects via looseTaylor Blau, May 20, 2022
  191. René ScharfeJun 19, 2022
  192. Junio C HamanoJun 21, 2022
  193. Ævar Arnfjörð BjarmasonMay 21, 2022
  194. Jonathan NiederMay 24, 2022
  195. Taylor BlauMay 24, 2022
  196. Ævar Arnfjörð BjarmasonMay 24, 2022
  197. Taylor BlauMay 24, 2022
  198. Jonathan NiederMay 25, 2022
  199. Derrick StoleeMay 25, 2022
  200. Taylor BlauMay 25, 2022
  201. Ævar Arnfjörð BjarmasonMay 26, 2022

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.