Skip to content

Commit 40864ac

Browse files
ttaylorrgitster
authored andcommitted
Documentation/gitpacking.txt: describe pseudo-merge bitmaps
Add some details to the gitpacking(7) manual page which motivate and describe pseudo-merge bitmaps. The exact on-disk format and many of the configuration knobs will be described in subsequent commits. Helped-by: Jeff King <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0074cc2 commit 40864ac

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

Documentation/gitpacking.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,78 @@ There are many aspects of packing in Git that are not covered in this
2424
document that instead live in the aforementioned areas. Over time, those
2525
scattered bits may coalesce into this document.
2626

27+
== Pseudo-merge bitmaps
28+
29+
NOTE: Pseudo-merge bitmaps are considered an experimental feature, so
30+
the configuration and many of the ideas are subject to change.
31+
32+
=== Background
33+
34+
Reachability bitmaps are most efficient when we have on-disk stored
35+
bitmaps for one or more of the starting points of a traversal. For this
36+
reason, Git prefers storing bitmaps for commits at the tips of refs,
37+
because traversals tend to start with those points.
38+
39+
But if you have a large number of refs, it's not feasible to store a
40+
bitmap for _every_ ref tip. It takes up space, and just OR-ing all of
41+
those bitmaps together is expensive.
42+
43+
One way we can deal with that is to create bitmaps that represent
44+
_groups_ of refs. When a traversal asks about the entire group, then we
45+
can use this single bitmap instead of considering each ref individually.
46+
Because these bitmaps represent the set of objects which would be
47+
reachable in a hypothetical merge of all of the commits, we call them
48+
pseudo-merge bitmaps.
49+
50+
=== Overview
51+
52+
A "pseudo-merge bitmap" is used to refer to a pair of bitmaps, as
53+
follows:
54+
55+
Commit bitmap::
56+
57+
A bitmap whose set bits describe the set of commits included in the
58+
pseudo-merge's "merge" bitmap (as below).
59+
60+
Merge bitmap::
61+
62+
A bitmap whose set bits describe the reachability closure over the set
63+
of commits in the pseudo-merge's "commits" bitmap (as above). An
64+
identical bitmap would be generated for an octopus merge with the same
65+
set of parents as described in the commits bitmap.
66+
67+
Pseudo-merge bitmaps can accelerate bitmap traversals when all commits
68+
for a given pseudo-merge are listed on either side of the traversal,
69+
either directly (by explicitly asking for them as part of the `HAVES`
70+
or `WANTS`) or indirectly (by encountering them during a fill-in
71+
traversal).
72+
73+
=== Use-cases
74+
75+
For example, suppose there exists a pseudo-merge bitmap with a large
76+
number of commits, all of which are listed in the `WANTS` section of
77+
some bitmap traversal query. When pseudo-merge bitmaps are enabled, the
78+
bitmap machinery can quickly determine there is a pseudo-merge which
79+
satisfies some subset of the wanted objects on either side of the query.
80+
Then, we can inflate the EWAH-compressed bitmap, and `OR` it in to the
81+
resulting bitmap. By contrast, without pseudo-merge bitmaps, we would
82+
have to repeat the decompression and `OR`-ing step over a potentially
83+
large number of individual bitmaps, which can take proportionally more
84+
time.
85+
86+
Another benefit of pseudo-merges arises when there is some combination
87+
of (a) a large number of references, with (b) poor bitmap coverage, and
88+
(c) deep, nested trees, making fill-in traversal relatively expensive.
89+
For example, suppose that there are a large enough number of tags where
90+
bitmapping each of the tags individually is infeasible. Without
91+
pseudo-merge bitmaps, computing the result of, say, `git rev-list
92+
--use-bitmap-index --count --objects --tags` would likely require a
93+
large amount of fill-in traversal. But when a large quantity of those
94+
tags are stored together in a pseudo-merge bitmap, the bitmap machinery
95+
can take advantage of the fact that we only care about the union of
96+
objects reachable from all of those tags, and answer the query much
97+
faster.
98+
2799
SEE ALSO
28100
--------
29101
linkgit:git-pack-objects[1]

0 commit comments

Comments
 (0)