Skip to content

Commit d508e43

Browse files
ttaylorrgitster
authored andcommitted
Documentation: describe incremental MIDX bitmaps
Prepare to implement support for reachability bitmaps for the new incremental multi-pack index (MIDX) feature over the following commits. This commit begins by first describing the relevant format and usage details for incremental MIDX bitmaps. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d876f3 commit d508e43

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

Documentation/technical/multi-pack-index.txt

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,70 @@ objects_nr($H2) + objects_nr($H1) + i
164164
(in the C implementation, this is often computed as `i +
165165
m->num_objects_in_base`).
166166

167+
=== Pseudo-pack order for incremental MIDXs
168+
169+
The original implementation of multi-pack reachability bitmaps defined
170+
the pseudo-pack order in linkgit:gitformat-pack[5] (see the section
171+
titled "multi-pack-index reverse indexes") roughly as follows:
172+
173+
____
174+
In short, a MIDX's pseudo-pack is the de-duplicated concatenation of
175+
objects in packs stored by the MIDX, laid out in pack order, and the
176+
packs arranged in MIDX order (with the preferred pack coming first).
177+
____
178+
179+
In the incremental MIDX design, we extend this definition to include
180+
objects from multiple layers of the MIDX chain. The pseudo-pack order
181+
for incremental MIDXs is determined by concatenating the pseudo-pack
182+
ordering for each layer of the MIDX chain in order. Formally two objects
183+
`o1` and `o2` are compared as follows:
184+
185+
1. If `o1` appears in an earlier layer of the MIDX chain than `o2`, then
186+
`o1` is considered less than `o2`.
187+
2. Otherwise, if `o1` and `o2` appear in the same MIDX layer, and that
188+
MIDX layer has no base, then If one of `pack(o1)` and `pack(o2)` is
189+
preferred and the other is not, then the preferred one sorts first. If
190+
there is a base layer (i.e. the MIDX layer is not the first layer in
191+
the chain), then if `pack(o1)` appears earlier in that MIDX layer's
192+
pack order, than `o1` is less than `o2`. Likewise if `pack(o2)`
193+
appears earlier, than the opposite is true.
194+
3. Otherwise, `o1` and `o2` appear in the same pack, and thus in the
195+
same MIDX layer. Sort `o1` and `o2` by their offset within their
196+
containing packfile.
197+
198+
=== Reachability bitmaps and incremental MIDXs
199+
200+
Each layer of an incremental MIDX chain may have its objects (and the
201+
objects from any previous layer in the same MIDX chain) represented in
202+
its own `*.bitmap` file.
203+
204+
The structure of a `*.bitmap` file belonging to an incremental MIDX
205+
chain is identical to that of a non-incremental MIDX bitmap, or a
206+
classic single-pack bitmap. Since objects are added to the end of the
207+
incremental MIDX's pseudo-pack order (see: above), it is possible to
208+
extend a bitmap when appending to the end of a MIDX chain.
209+
210+
(Note: it is possible likewise to compress a contiguous sequence of MIDX
211+
incremental layers, and their `*.bitmap`(s) into a single layer and
212+
`*.bitmap`, but this is not yet implemented.)
213+
214+
The object positions used are global within the pseudo-pack order, so
215+
subsequent layers will have, for example, `m->num_objects_in_base`
216+
number of `0` bits in each of their four type bitmaps. This follows from
217+
the fact that we only write type bitmap entries for objects present in
218+
the layer immediately corresponding to the bitmap).
219+
220+
Note also that only the bitmap pertaining to the most recent layer in an
221+
incremental MIDX chain is used to store reachability information about
222+
the interesting and uninteresting objects in a reachability query.
223+
Earlier bitmap layers are only used to look up commit and pseudo-merge
224+
bitmaps from that layer, as well as the type-level bitmaps for objects
225+
in that layer.
226+
227+
To simplify the implementation, type-level bitmaps are iterated
228+
simultaneously, and their results are OR'd together to avoid recursively
229+
calling internal bitmap functions.
230+
167231
Future Work
168232
-----------
169233

0 commit comments

Comments
 (0)