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

Re: [PATCH v2 19/19] midx: implement support for writing incremental MIDX chains

From
Jeff King <peff@peff.net>
Date
Aug 1, 2024, 11:07 UTC
Message-ID
<20240801110722.GR1159276@coredump.intra.peff.net>
In-Reply-To
<e2b5961b4556122e594b657efe2f1d3337368cdd.1721250704.git.me@ttaylorr.com>
On Wed, Jul 17, 2024 at 05:12:53PM -0400, Taylor Blau wrote:
Show 6 quoted lines
> The implementation for doing so is relatively straightforward, and boils
> down to a handful of different kinds of changes implemented in this
> patch:
> 
>   - The `compute_sorted_entries()` function is taught to reject objects
>     which appear in any existing MIDX layer.

OK, I think this is one part I was looking for earlier but didn't see. The implementation looks pretty easy (we can always ask about just the earlier layers by feeding the base_midx pointer to midx_has_oid(), etc).

Show 13 quoted lines
>   - Functions like `write_midx_revindex()` are adjusted to write
>     pack_order values which are offset by the number of objects in the
>     base MIDX layer.
> 
>   - The end of `write_midx_internal()` is adjusted to move
>     non-incremental MIDX files when necessary (i.e. when creating an
>     incremental chain with an existing non-incremental MIDX in the
>     repository).
> 
> There are a handful of other changes that are introduced, like new
> functions to clear incremental MIDX files that are unrelated to the
> current chain (using the same "keep_hash" mechanism as in the
> non-incremental case).

That all makes sense. I wondered a bit about selection of packs, size of incremental, etc. We'd probably want a geometric-ish progression, just like with packs, to balance cost of generation versus cost of lookups. But I guess we get that for free to some degree with "repack --geometric", assuming that our incremental midx is just covering the new packfiles.

Show 10 quoted lines
> The tests explicitly exercising the new incremental MIDX feature are
> relatively limited for two reasons:
> 
>   1. Most of the "interesting" behavior is already thoroughly covered in
>      t5319-multi-pack-index.sh, which handles the core logic of reading
>      objects through a MIDX.
> 
>      The new tests in t5334-incremental-multi-pack-index.sh are mostly
>      focused on creating and destroying incremental MIDXs, as well as
>      stitching their results together across layers.

Do you mean here that t5319 will get coverage when GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL is set? In the long run, I wonder if we should pull t5319's tests into lib-midx.sh and run them in incremental and non-incremental modes.

Show 8 quoted lines
>   2. A new GIT_TEST environment variable is added called
>      "GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL", which modifies the
>      entire test suite to write incremental MIDXs after repacking when
>      combined with the "GIT_TEST_MULTI_PACK_INDEX" variable.
> 
>      This exercises the long tail of other interesting behavior that is
>      defined implicitly throughout the rest of the CI suite. It is
>      likewise added to the linux-TEST-vars job.
Makes sense.
Show 13 quoted lines
> diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
> index 8f34f05087..be1188e736 100755
> --- a/t/t7700-repack.sh
> +++ b/t/t7700-repack.sh
> @@ -7,6 +7,9 @@ test_description='git repack works correctly'
>  . "${TEST_DIRECTORY}/lib-midx.sh"
>  . "${TEST_DIRECTORY}/lib-terminal.sh"
>  
> +GIT_TEST_MULTI_PACK_INDEX=0
> +GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=0
> [...]
> -		GIT_TEST_MULTI_PACK_INDEX=0 git repack -Adl --write-bitmap-index 2>err &&
> +		git repack -Adl --write-bitmap-index 2>err &&

This pulls the GIT_TEST_MULTI_PACK_INDEX=0 out of the individual tests and sets it for the whole file. Are we losing some coverage for the other tests? I doubt it's that big a deal either way (and I can certainly see the argument that t7700, which is concerned with the details of repacking, should be in control of the details of midx generation). But I wonder if just setting WRITE_INCREMENTAL=0 would be enough?

The rest of the changes all looked pretty reasonable, though again, it's easy to review code you wrote and say "that looks good" but not realize any gotchas that both of us missed.

-Peff
Previous: Taylor BlauNext: Taylor Blau
Message 78 of 102 in “midx: incremental multi-pack indexes, part one”
  1. 00/19 midx: incremental multi-pack indexes, part oneTaylor Blau, Jun 6, 2024
  2. 01/19 Documentation: describe incremental MIDX formatTaylor Blau, Jun 6, 2024
  3. 02/19 midx: add new fields for incremental MIDX chainsTaylor Blau, Jun 6, 2024
  4. 03/19 midx: teach `nth_midxed_pack_int_id()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  5. 04/19 midx: teach `prepare_midx_pack()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  6. 05/19 midx: teach `nth_midxed_object_oid()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  7. 06/19 midx: teach `nth_bitmapped_pack()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  8. 07/19 midx: introduce `bsearch_one_midx()`Taylor Blau, Jun 6, 2024
  9. 08/19 midx: teach `bsearch_midx()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  10. 09/19 midx: teach `nth_midxed_offset()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  11. 10/19 midx: teach `fill_midx_entry()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  12. 11/19 midx: remove unused `midx_locate_pack()`Taylor Blau, Jun 6, 2024
  13. 12/19 midx: teach `midx_contains_pack()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  14. 13/19 midx: teach `midx_preferred_pack()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  15. 14/19 midx: teach `midx_fanout_add_midx_fanout()` about incremental MIDXsTaylor Blau, Jun 6, 2024
  16. 15/19 midx: support reading incremental MIDX chainsTaylor Blau, Jun 6, 2024
  17. 16/19 midx: implement verification support for incremental MIDXsTaylor Blau, Jun 6, 2024
  18. 17/19 t: retire 'GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP'Taylor Blau, Jun 6, 2024
  19. 18/19 t/t5313-pack-bounds-checks.sh: prepare for sub-directoriesTaylor Blau, Jun 6, 2024
  20. 19/19 midx: implement support for writing incremental MIDX chainsTaylor Blau, Jun 6, 2024
  21. Taylor BlauJun 6, 2024
  22. Junio C HamanoJun 7, 2024
  23. Taylor BlauJun 7, 2024
  24. Junio C HamanoJun 7, 2024
  25. Taylor BlauJun 7, 2024
  26. Junio C HamanoJun 25, 2024
  27. Elijah NewrenJun 26, 2024
  28. 00/19 midx: incremental multi-pack indexes, part oneTaylor Blau, Jul 17, 2024
  29. 01/19 Documentation: describe incremental MIDX formatTaylor Blau, Jul 17, 2024
  30. Jeff KingAug 1, 2024
  31. Taylor BlauAug 1, 2024
  32. 02/19 midx: add new fields for incremental MIDX chainsTaylor Blau, Jul 17, 2024
  33. Jeff KingAug 1, 2024
  34. Taylor BlauAug 1, 2024
  35. 03/19 midx: teach `nth_midxed_pack_int_id()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  36. Jeff KingAug 1, 2024
  37. Taylor BlauAug 1, 2024
  38. 04/19 midx: teach `prepare_midx_pack()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  39. Jeff KingAug 1, 2024
  40. Taylor BlauAug 1, 2024
  41. 05/19 midx: teach `nth_midxed_object_oid()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  42. Jeff KingAug 1, 2024
  43. Taylor BlauAug 1, 2024
  44. 06/19 midx: teach `nth_bitmapped_pack()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  45. Jeff KingAug 1, 2024
  46. Taylor BlauAug 1, 2024
  47. 07/19 midx: introduce `bsearch_one_midx()`Taylor Blau, Jul 17, 2024
  48. Jeff KingAug 1, 2024
  49. Taylor BlauAug 1, 2024
  50. 08/19 midx: teach `bsearch_midx()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  51. Jeff KingAug 1, 2024
  52. 09/19 midx: teach `nth_midxed_offset()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  53. Jeff KingAug 1, 2024
  54. 10/19 midx: teach `fill_midx_entry()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  55. Jeff KingAug 1, 2024
  56. Taylor BlauAug 1, 2024
  57. 11/19 midx: remove unused `midx_locate_pack()`Taylor Blau, Jul 17, 2024
  58. Jeff KingAug 1, 2024
  59. Taylor BlauAug 1, 2024
  60. 12/19 midx: teach `midx_contains_pack()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  61. Jeff KingAug 1, 2024
  62. 13/19 midx: teach `midx_preferred_pack()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  63. Jeff KingAug 1, 2024
  64. Taylor BlauAug 1, 2024
  65. 14/19 midx: teach `midx_fanout_add_midx_fanout()` about incremental MIDXsTaylor Blau, Jul 17, 2024
  66. Jeff KingAug 1, 2024
  67. Taylor BlauAug 1, 2024
  68. 15/19 midx: support reading incremental MIDX chainsTaylor Blau, Jul 17, 2024
  69. Jeff KingAug 1, 2024
  70. Taylor BlauAug 1, 2024
  71. 16/19 midx: implement verification support for incremental MIDXsTaylor Blau, Jul 17, 2024
  72. Jeff KingAug 1, 2024
  73. 17/19 t: retire 'GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP'Taylor Blau, Jul 17, 2024
  74. Jeff KingAug 1, 2024
  75. Taylor BlauAug 1, 2024
  76. 18/19 t/t5313-pack-bounds-checks.sh: prepare for sub-directoriesTaylor Blau, Jul 17, 2024
  77. 19/19 midx: implement support for writing incremental MIDX chainsTaylor Blau, Jul 17, 2024
  78. Jeff KingAug 1, 2024
  79. Taylor BlauAug 1, 2024
  80. Jeff KingAug 1, 2024
  81. Taylor BlauAug 1, 2024
  82. 00/19 midx: incremental multi-pack indexes, part oneTaylor Blau, Aug 6, 2024
  83. 01/19 Documentation: describe incremental MIDX formatTaylor Blau, Aug 6, 2024
  84. 02/19 midx: add new fields for incremental MIDX chainsTaylor Blau, Aug 6, 2024
  85. 03/19 midx: teach `nth_midxed_pack_int_id()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  86. 04/19 midx: teach `prepare_midx_pack()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  87. 05/19 midx: teach `nth_midxed_object_oid()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  88. 06/19 midx: teach `nth_bitmapped_pack()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  89. 07/19 midx: introduce `bsearch_one_midx()`Taylor Blau, Aug 6, 2024
  90. 08/19 midx: teach `bsearch_midx()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  91. 09/19 midx: teach `nth_midxed_offset()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  92. 10/19 midx: teach `fill_midx_entry()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  93. 11/19 midx: remove unused `midx_locate_pack()`Taylor Blau, Aug 6, 2024
  94. 12/19 midx: teach `midx_contains_pack()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  95. 13/19 midx: teach `midx_preferred_pack()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  96. 14/19 midx: teach `midx_fanout_add_midx_fanout()` about incremental MIDXsTaylor Blau, Aug 6, 2024
  97. 15/19 midx: support reading incremental MIDX chainsTaylor Blau, Aug 6, 2024
  98. 16/19 midx: implement verification support for incremental MIDXsTaylor Blau, Aug 6, 2024
  99. 17/19 t: retire 'GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP'Taylor Blau, Aug 6, 2024
  100. 18/19 t/t5313-pack-bounds-checks.sh: prepare for sub-directoriesTaylor Blau, Aug 6, 2024
  101. 19/19 midx: implement support for writing incremental MIDX chainsTaylor Blau, Aug 6, 2024
  102. Jeff KingAug 12, 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.