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

Re: [PATCH v4 01/13] Documentation: describe incremental MIDX bitmaps

From
Taylor Blau <me@ttaylorr.com>
Date
Mar 18, 2025, 23:11 UTC
Message-ID
<Z9n9jf7GDBMPyM2R@nand.local>
In-Reply-To
<20250318011618.GA1471939@coredump.intra.peff.net>
On Mon, Mar 17, 2025 at 09:16:18PM -0400, Jeff King wrote:
Show 36 quoted lines
> On Fri, Mar 14, 2025 at 04:18:20PM -0400, Taylor Blau wrote:
>
> > +In the incremental MIDX design, we extend this definition to include
> > +objects from multiple layers of the MIDX chain. The pseudo-pack order
> > +for incremental MIDXs is determined by concatenating the pseudo-pack
> > +ordering for each layer of the MIDX chain in order. Formally two objects
> > +`o1` and `o2` are compared as follows:
> > +
> > +1. If `o1` appears in an earlier layer of the MIDX chain than `o2`, then
> > +  `o1` is considered less than `o2`.
> > +
> > +2. Otherwise, if `o1` and `o2` appear in the same MIDX layer, and that
> > +   MIDX layer has no base, then if one of `pack(o1)` and `pack(o2)` is
> > +   preferred and the other is not, then the preferred one sorts first. If
> > +   there is a base layer (i.e. the MIDX layer is not the first layer in
> > +   the chain), then if `pack(o1)` appears earlier in that MIDX layer's
> > +   pack order, than `o1` is less than `o2`. Likewise if `pack(o2)`
> > +   appears earlier, than the opposite is true.
> > +
> > +3. Otherwise, `o1` and `o2` appear in the same pack, and thus in the
> > +   same MIDX layer. Sort `o1` and `o2` by their offset within their
> > +   containing packfile.
>
> OK, I think this ordering makes sense. I had to read this description
> over several times to make sure I wasn't missing something. The earlier
> part that says "it's just concatenating the pack order of the layers" is
> a much more intuitive way of looking at it (modulo that you might need
> to remove duplicates found in earlier layers).
>
> But I think an even more basic way of thinking about it is that it's the
> same as the pseudo-pack order you would get if you had a single midx of
> all of the packs in all of the layers (in their layer order). We already
> have to deal with (and have documented) duplicates in that case.
>
> Not really suggesting any wording change here, just making sure I
> grokked it all.

Yeah, those are both excellent ways to think about it. I hadn't considered the "the new ordering is the same as the pseudo-pack order you'd get if you had a single MIDX of all the packs in layer order" thing before, but it's quite intuitive.

As a side note, it's somewhat hilarious to me that we could really write:

    "The new ordering is the same as the pseudo-pack order you'd get if
    you had a single MIDX of all the packs in layer order, which is the
    same order you'd get if you had a single pack containing all of the
    objects in MIDX order."
;-)
Show 7 quoted lines
> > +Note that the preferred pack is a property of the MIDX chain, not the
> > +individual layers themselves. Fundamentally we could introduce a
> > +per-layer preferred pack, but this is less relevant now that we can
> > +perform multi-pack reuse across the set of packs in a MIDX.
>
> Calling this out explicitly is good, since it's an obvious question
> for somebody to have.

Thanks, I think this was an addition from Patrick's earlier review of the series.

Show 28 quoted lines
> OK, so each layer's bitmap does depend on the layers above/before it.
> That obviously needs to happen because each incremental midx is not
> likely to be a complete reachability set anyway.
>
> But I also wondered what would happen with a situation like this:
>
>   A -- B
>    \
>     -- C
>
> stored like this:
>
>   base midx:
>     - pack 1:
>       - object A
>       - object B, which can reach A
>   incremental midx:
>     - pack 2:
>       - object A
>       - object C, which can reach A
>
> That is, two objects B and C both depend on A, which is duplicated in
> two midx layers. Even if the incremental midx is complete in the sense
> that C only depends on A, its bitmap cannot just be "11". Because the
> bit position for object A in the incremental midx does not exist in the
> pseudo-pack order at all! It must refer to the copy of "A" in the base
> midx, so it's correct bitmap is "101" (A and C, but not B).
>

Right. Since the base MIDX has objects A and B, B's bitmap here would be "11". C's bit position in the subsequent layer is a function of where it sits not just in that MIDX layer, but how many (de-duplicated) objects exist in all prior layers. There are two, so the earliest bit position possible to allocate towards C is the third bit. And since C reaches A, its bitmap would indeed be "101".

> Again, just talking through it here.

Heh, thanks for saying so. It's good to know when we're just talking through examples versus asking for changes. (Of course, the mere fact of talking through an example is sometimes enough to suggest a change by virtue of that example being confusing enough to need to be talked through in the first place).

Show 10 quoted lines
> > +Note also that only the bitmap pertaining to the most recent layer in an
> > +incremental MIDX chain is used to store reachability information about
> > +the interesting and uninteresting objects in a reachability query.
> > +Earlier bitmap layers are only used to look up commit and pseudo-merge
> > +bitmaps from that layer, as well as the type-level bitmaps for objects
> > +in that layer.
>
> I'm not quite sure what this means, but I guess you're saying that
> internally as we produce a bitmap, we'll always use the complete bitmap
> over all of the layers?
That's exactly right.
Show 7 quoted lines
> > +To simplify the implementation, type-level bitmaps are iterated
> > +simultaneously, and their results are OR'd together to avoid recursively
> > +calling internal bitmap functions.
>
> OK, I guess we'll see what this means in the patches. ;)
>
> The general rules for the data structure make sense to me, though.

Great, and thanks in advance for the review as I work through the rest of your emails :-).

Thanks, Taylor

Previous: Jeff KingNext: Elijah Newren
Message 74 of 135 in “midx: incremental multi-pack indexes, part two”
  1. 00/13 midx: incremental multi-pack indexes, part twoTaylor Blau, Aug 15, 2024
  2. 01/13 Documentation: describe incremental MIDX bitmapsTaylor Blau, Aug 15, 2024
  3. 02/13 pack-revindex: prepare for incremental MIDX bitmapsTaylor Blau, Aug 15, 2024
  4. 03/13 pack-bitmap.c: open and store incremental bitmap layersTaylor Blau, Aug 15, 2024
  5. 04/13 pack-bitmap.c: teach `bitmap_for_commit()` about incremental MIDXsTaylor Blau, Aug 15, 2024
  6. 05/13 pack-bitmap.c: teach `show_objects_for_type()` about incremental MIDXsTaylor Blau, Aug 15, 2024
  7. 06/13 pack-bitmap.c: support bitmap pack-reuse with incremental MIDXsTaylor Blau, Aug 15, 2024
  8. 07/13 pack-bitmap.c: teach `rev-list --test-bitmap` about incremental MIDXsTaylor Blau, Aug 15, 2024
  9. 08/13 pack-bitmap.c: compute disk-usage with incremental MIDXsTaylor Blau, Aug 15, 2024
  10. 09/13 pack-bitmap.c: apply pseudo-merge commits with incremental MIDXsTaylor Blau, Aug 15, 2024
  11. 10/13 ewah: implement `struct ewah_or_iterator`Taylor Blau, Aug 15, 2024
  12. 11/13 pack-bitmap.c: keep track of each layer's type bitmapsTaylor Blau, Aug 15, 2024
  13. 12/13 pack-bitmap.c: use `ewah_or_iterator` for type bitmap iteratorsTaylor Blau, Aug 15, 2024
  14. 13/13 midx: implement writing incremental MIDX bitmapsTaylor Blau, Aug 15, 2024
  15. 00/13 midx: incremental multi-pack indexes, part twoTaylor Blau, Aug 15, 2024
  16. 01/13 Documentation: describe incremental MIDX bitmapsTaylor Blau, Aug 15, 2024
  17. 02/13 pack-revindex: prepare for incremental MIDX bitmapsTaylor Blau, Aug 15, 2024
  18. 03/13 pack-bitmap.c: open and store incremental bitmap layersTaylor Blau, Aug 15, 2024
  19. 04/13 pack-bitmap.c: teach `bitmap_for_commit()` about incremental MIDXsTaylor Blau, Aug 15, 2024
  20. 05/13 pack-bitmap.c: teach `show_objects_for_type()` about incremental MIDXsTaylor Blau, Aug 15, 2024
  21. 06/13 pack-bitmap.c: support bitmap pack-reuse with incremental MIDXsTaylor Blau, Aug 15, 2024
  22. 07/13 pack-bitmap.c: teach `rev-list --test-bitmap` about incremental MIDXsTaylor Blau, Aug 15, 2024
  23. 08/13 pack-bitmap.c: compute disk-usage with incremental MIDXsTaylor Blau, Aug 15, 2024
  24. 09/13 pack-bitmap.c: apply pseudo-merge commits with incremental MIDXsTaylor Blau, Aug 15, 2024
  25. 10/13 ewah: implement `struct ewah_or_iterator`Taylor Blau, Aug 15, 2024
  26. 11/13 pack-bitmap.c: keep track of each layer's type bitmapsTaylor Blau, Aug 15, 2024
  27. 12/13 pack-bitmap.c: use `ewah_or_iterator` for type bitmap iteratorsTaylor Blau, Aug 15, 2024
  28. 13/13 midx: implement writing incremental MIDX bitmapsTaylor Blau, Aug 15, 2024
  29. fixup! midx: implement writing incremental MIDX bitmapsJunio C Hamano, Aug 28, 2024
  30. Jeff KingAug 28, 2024
  31. Taylor BlauAug 29, 2024
  32. Jeff KingAug 29, 2024
  33. Taylor BlauNov 19, 2024
  34. 00/13 midx: incremental multi-pack indexes, part twoTaylor Blau, Nov 19, 2024
  35. 01/13 Documentation: describe incremental MIDX bitmapsTaylor Blau, Nov 19, 2024
  36. Patrick SteinhardtFeb 28, 2025
  37. Taylor BlauFeb 28, 2025
  38. Patrick SteinhardtMar 3, 2025
  39. 02/13 pack-revindex: prepare for incremental MIDX bitmapsTaylor Blau, Nov 19, 2024
  40. Patrick SteinhardtFeb 28, 2025
  41. Taylor BlauFeb 28, 2025
  42. 03/13 pack-bitmap.c: open and store incremental bitmap layersTaylor Blau, Nov 19, 2024
  43. Patrick SteinhardtFeb 28, 2025
  44. Taylor BlauFeb 28, 2025
  45. Patrick SteinhardtMar 3, 2025
  46. 04/13 pack-bitmap.c: teach `bitmap_for_commit()` about incremental MIDXsTaylor Blau, Nov 19, 2024
  47. Patrick SteinhardtFeb 28, 2025
  48. Taylor BlauMar 1, 2025
  49. 05/13 pack-bitmap.c: teach `show_objects_for_type()` about incremental MIDXsTaylor Blau, Nov 19, 2024
  50. 06/13 pack-bitmap.c: support bitmap pack-reuse with incremental MIDXsTaylor Blau, Nov 19, 2024
  51. Patrick SteinhardtFeb 28, 2025
  52. Taylor BlauMar 1, 2025
  53. 07/13 pack-bitmap.c: teach `rev-list --test-bitmap` about incremental MIDXsTaylor Blau, Nov 19, 2024
  54. Patrick SteinhardtFeb 28, 2025
  55. Taylor BlauMar 1, 2025
  56. 08/13 pack-bitmap.c: compute disk-usage with incremental MIDXsTaylor Blau, Nov 19, 2024
  57. 09/13 pack-bitmap.c: apply pseudo-merge commits with incremental MIDXsTaylor Blau, Nov 19, 2024
  58. 10/13 ewah: implement `struct ewah_or_iterator`Taylor Blau, Nov 19, 2024
  59. Patrick SteinhardtFeb 28, 2025
  60. Taylor BlauMar 1, 2025
  61. 11/13 pack-bitmap.c: keep track of each layer's type bitmapsTaylor Blau, Nov 19, 2024
  62. Patrick SteinhardtFeb 28, 2025
  63. Taylor BlauMar 1, 2025
  64. 12/13 pack-bitmap.c: use `ewah_or_iterator` for type bitmap iteratorsTaylor Blau, Nov 19, 2024
  65. Patrick SteinhardtFeb 28, 2025
  66. Taylor BlauMar 1, 2025
  67. 13/13 midx: implement writing incremental MIDX bitmapsTaylor Blau, Nov 19, 2024
  68. Patrick SteinhardtFeb 28, 2025
  69. Taylor BlauMar 1, 2025
  70. Junio C HamanoNov 20, 2024
  71. 00/13 midx: incremental multi-pack indexes, part twoTaylor Blau, Mar 14, 2025
  72. 01/13 Documentation: describe incremental MIDX bitmapsTaylor Blau, Mar 14, 2025
  73. Jeff KingMar 18, 2025
  74. Taylor BlauMar 18, 2025
  75. Elijah NewrenMar 18, 2025
  76. Taylor BlauMar 18, 2025
  77. 02/13 pack-revindex: prepare for incremental MIDX bitmapsTaylor Blau, Mar 14, 2025
  78. Jeff KingMar 18, 2025
  79. Taylor BlauMar 19, 2025
  80. Taylor BlauMar 19, 2025
  81. Jeff KingMar 26, 2025
  82. Elijah NewrenMar 18, 2025
  83. Taylor BlauMar 19, 2025
  84. 03/13 pack-bitmap.c: open and store incremental bitmap layersTaylor Blau, Mar 14, 2025
  85. Elijah NewrenMar 18, 2025
  86. Taylor BlauMar 19, 2025
  87. 04/13 pack-bitmap.c: teach `bitmap_for_commit()` about incremental MIDXsTaylor Blau, Mar 14, 2025
  88. Jeff KingMar 18, 2025
  89. Taylor BlauMar 19, 2025
  90. 05/13 pack-bitmap.c: teach `show_objects_for_type()` about incremental MIDXsTaylor Blau, Mar 14, 2025
  91. 06/13 pack-bitmap.c: support bitmap pack-reuse with incremental MIDXsTaylor Blau, Mar 14, 2025
  92. Elijah NewrenMar 18, 2025
  93. Taylor BlauMar 19, 2025
  94. 07/13 pack-bitmap.c: teach `rev-list --test-bitmap` about incremental MIDXsTaylor Blau, Mar 14, 2025
  95. Elijah NewrenMar 18, 2025
  96. Taylor BlauMar 19, 2025
  97. 08/13 pack-bitmap.c: compute disk-usage with incremental MIDXsTaylor Blau, Mar 14, 2025
  98. Jeff KingMar 18, 2025
  99. Taylor BlauMar 19, 2025
  100. 09/13 pack-bitmap.c: apply pseudo-merge commits with incremental MIDXsTaylor Blau, Mar 14, 2025
  101. 10/13 ewah: implement `struct ewah_or_iterator`Taylor Blau, Mar 14, 2025
  102. Jeff KingMar 18, 2025
  103. Taylor BlauMar 19, 2025
  104. 11/13 pack-bitmap.c: keep track of each layer's type bitmapsTaylor Blau, Mar 14, 2025
  105. Jeff KingMar 18, 2025
  106. Taylor BlauMar 19, 2025
  107. Elijah NewrenMar 18, 2025
  108. Taylor BlauMar 19, 2025
  109. 12/13 pack-bitmap.c: use `ewah_or_iterator` for type bitmap iteratorsTaylor Blau, Mar 14, 2025
  110. Jeff KingMar 18, 2025
  111. Taylor BlauMar 19, 2025
  112. 13/13 midx: implement writing incremental MIDX bitmapsTaylor Blau, Mar 14, 2025
  113. Jeff KingMar 18, 2025
  114. Taylor BlauMar 20, 2025
  115. Elijah NewrenMar 18, 2025
  116. Taylor BlauMar 20, 2025
  117. Jeff KingMar 18, 2025
  118. Taylor BlauMar 20, 2025
  119. 00/14 midx: incremental multi-pack indexes, part twoTaylor Blau, Mar 20, 2025
  120. 01/14 Documentation: remove a "future work" item from the MIDX docsTaylor Blau, Mar 20, 2025
  121. 02/14 Documentation: describe incremental MIDX bitmapsTaylor Blau, Mar 20, 2025
  122. 03/14 pack-revindex: prepare for incremental MIDX bitmapsTaylor Blau, Mar 20, 2025
  123. 04/14 pack-bitmap.c: open and store incremental bitmap layersTaylor Blau, Mar 20, 2025
  124. 05/14 pack-bitmap.c: teach `bitmap_for_commit()` about incremental MIDXsTaylor Blau, Mar 20, 2025
  125. 06/14 pack-bitmap.c: teach `show_objects_for_type()` about incremental MIDXsTaylor Blau, Mar 20, 2025
  126. 07/14 pack-bitmap.c: support bitmap pack-reuse with incremental MIDXsTaylor Blau, Mar 20, 2025
  127. 08/14 pack-bitmap.c: teach `rev-list --test-bitmap` about incremental MIDXsTaylor Blau, Mar 20, 2025
  128. 09/14 pack-bitmap.c: compute disk-usage with incremental MIDXsTaylor Blau, Mar 20, 2025
  129. 10/14 pack-bitmap.c: apply pseudo-merge commits with incremental MIDXsTaylor Blau, Mar 20, 2025
  130. 11/14 ewah: implement `struct ewah_or_iterator`Taylor Blau, Mar 20, 2025
  131. 12/14 pack-bitmap.c: keep track of each layer's type bitmapsTaylor Blau, Mar 20, 2025
  132. 13/14 pack-bitmap.c: use `ewah_or_iterator` for type bitmap iteratorsTaylor Blau, Mar 20, 2025
  133. 14/14 midx: implement writing incremental MIDX bitmapsTaylor Blau, Mar 20, 2025
  134. Elijah NewrenMar 20, 2025
  135. Taylor BlauMar 20, 2025

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.