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

[PATCH 01/19] Documentation: describe incremental MIDX format

From
Taylor Blau <me@ttaylorr.com>
Date
Jun 6, 2024, 23:04 UTC
Message-ID
<d3aaf18b0a8a17c16d111d93042af52268800989.1717715060.git.me@ttaylorr.com>
In-Reply-To
<cover.1717715060.git.me@ttaylorr.com>

Prepare to implement incremental multi-pack indexes (MIDXs) over the next several commits by first describing the relevant prerequisites (like a new chunk in the MIDX format, the directory structure for incremental MIDXs, etc.)

The format is described in detail in the patch contents below, but the high-level description is as follows.

Incremental MIDXs live in $GIT_DIR/objects/pack/multi-pack-index.d, and each `*.midx` within that directory has a single "parent" MIDX, which is the MIDX layer immediately before it in the MIDX chain. The chain order resides in a file 'multi-pack-index-chain' in the same directory.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 Documentation/technical/multi-pack-index.txt | 100 +++++++++++++++++++
 1 file changed, 100 insertions(+)
diff --git a/Documentation/technical/multi-pack-index.txt b/Documentation/technical/multi-pack-index.txt
index f2221d2b44..d05e3d6dd9 100644
--- a/Documentation/technical/multi-pack-index.txt
+++ b/Documentation/technical/multi-pack-index.txt
@@ -61,6 +61,106 @@ Design Details
 - The MIDX file format uses a chunk-based approach (similar to the
   commit-graph file) that allows optional data to be added.
 
+Incremental multi-pack indexes
+------------------------------
+
+As repositories grow in size, it becomes more expensive to write a
+multi-pack index (MIDX) that includes all packfiles. To accommodate
+this, the "incremental multi-pack indexes" feature allows for combining
+a "chain" of multi-pack indexes.
+
+Each individual component of the chain need only contain a small number
+of packfiles. Appending to the chain does not invalidate earlier parts
+of the chain, so repositories can control how much time is spent
+updating the MIDX chain by determining the number of packs in each layer
+of the MIDX chain.
+
+=== Design state
+
+At present, the incremental multi-pack indexes feature is missing two
+important components:
+
+  - The ability to rewrite earlier portions of the MIDX chain (i.e., to
+    "compact" some collection of adjacent MIDX layers into a single
+    MIDX). At present the only supported way of shrinking a MIDX chain
+    is to rewrite the entire chain from scratch without the `--split`
+    flag.
++
+There are no fundamental limitations that stand in the way of being able
+to implement this feature. It is omitted from the initial implementation
+in order to reduce the complexity, but will be added later.
+
+  - Support for reachability bitmaps. The classic single MIDX
+    implementation does support reachability bitmaps (see the section
+    titled "multi-pack-index reverse indexes" in
+    linkgit:gitformat-pack[5] for more details).
++
+As above, there are no fundamental limitations that stand in the way of
+extending the incremental MIDX format to support reachability bitmaps.
+The design below specifically takes this into account, and support for
+reachability bitmaps will be added in a future patch series. It is
+omitted from this series for the same reason as above.
++
+In brief, to support reachability bitmaps with the incremental MIDX
+feature, the concept of the pseudo-pack order is extended across each
+layer of the incremental MIDX chain to form a concatenated pseudo-pack
+order. This concatenation takes place in the same order as the chain
+itself (in other words, the concatenated pseudo-pack order for a chain
+`{$H1, $H2, $H3}` would be the pseudo-pack order for `$H1`, followed by
+the pseudo-pack order for `$H2`, followed by the pseudo-pack order for
+`$H3`).
++
+The layout will then be extended so that each layer of the incremental
+MIDX chain can write a `*.bitmap`. The objects in each layer's bitmap
+are offset by the number of objects in the previous layers of the chain.
+
+=== File layout
+
+Instead of storing a single `multi-pack-index` file (with an optional
+`.rev` and `.bitmap` extension) in `$GIT_DIR/objects/pack`, incremental
+MIDXs are stored in the following layout:
+
+----
+$GIT_DIR/objects/pack/multi-pack-index.d/
+$GIT_DIR/objects/pack/multi-pack-index.d/multi-pack-index-chain
+$GIT_DIR/objects/pack/multi-pack-index.d/multi-pack-index-$H1.midx
+$GIT_DIR/objects/pack/multi-pack-index.d/multi-pack-index-$H2.midx
+$GIT_DIR/objects/pack/multi-pack-index.d/multi-pack-index-$H3.midx
+----
+
+The `multi-pack-index-chain` file contains a list of the incremental
+MIDX files in the chain, in order. The above example shows a chain whose
+`multi-pack-index-chain` file would contain the following lines:
+
+----
+$H1
+$H2
+$H3
+----
+
+The `multi-pack-index-$H1.midx` file contains the first layer of the
+multi-pack-index chain. The `multi-pack-index-$H2.midx` file contains
+the second layer of the chain, and so on.
+
+=== Object positions for incremental MIDXs
+
+In the original multi-pack-index design, we refer to objects via their
+lexicographic position (by object IDs) within the repository's singular
+multi-pack-index. In the incremental multi-pack-index design, we refer
+to objects via their index into a concatenated lexicographic ordering
+among each component in the MIDX chain.
+
+If `objects_nr()` is a function that returns the number of objects in a
+given MIDX layer, then the index of an object at lexicographic position
+`i` within, say, $H3 is defined as:
+
+----
+objects_nr($H2) + objects_nr($H1) + i
+----
+
+(in the C implementation, this is often computed as `i +
+m->num_objects_in_base`).
+
 Future Work
 -----------
 
-- 
2.45.2.437.gecb9450a0e
Previous: Taylor BlauNext: Taylor Blau
Message 2 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.