diff mbox series

[v4,3/9] pack-revindex.c: instrument loading on-disk reverse index

Message ID abc18613e04a3bb8571926cb653296fe6b49cc60.1643150456.git.me@ttaylorr.com (mailing list archive)
State Accepted
Commit 09a77999e787911244e2a8d09fdce7a7428429f4
Headers show
Series midx: prevent bitmap corruption when permuting pack order | expand

Commit Message

Taylor Blau Jan. 25, 2022, 10:41 p.m. UTC
In a subsequent commit, we'll use the MIDX's new 'RIDX' chunk as a
source for the reverse index's data. But it will be useful for tests to
be able to determine whether the reverse index was loaded from the
separate .rev file, or from a chunk within the MIDX.

To instrument this, add a trace2 event which the tests can look for in
order to determine the reverse index's source.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 pack-revindex.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ævar Arnfjörð Bjarmason Jan. 26, 2022, 3:03 p.m. UTC | #1
On Tue, Jan 25 2022, Taylor Blau wrote:

> In a subsequent commit, we'll use the MIDX's new 'RIDX' chunk as a
> source for the reverse index's data. But it will be useful for tests to
> be able to determine whether the reverse index was loaded from the
> separate .rev file, or from a chunk within the MIDX.
>
> To instrument this, add a trace2 event which the tests can look for in
> order to determine the reverse index's source.
>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
>  pack-revindex.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/pack-revindex.c b/pack-revindex.c
> index 70d0fbafcb..bd15ebad03 100644
> --- a/pack-revindex.c
> +++ b/pack-revindex.c
> @@ -301,6 +301,9 @@ int load_midx_revindex(struct multi_pack_index *m)
>  	if (m->revindex_data)
>  		return 0;
>  
> +	trace2_data_string("load_midx_revindex", the_repository,
> +			   "source", "rev");
> +
>  	get_midx_rev_filename(&revindex_name, m);
>  
>  	ret = load_revindex_from_disk(revindex_name.buf,

IMO easier to read/reason about if squashed into 5/9, where it's first
used, or at least re-arrange it so that 4/9 isn't between the two...
diff mbox series

Patch

diff --git a/pack-revindex.c b/pack-revindex.c
index 70d0fbafcb..bd15ebad03 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -301,6 +301,9 @@  int load_midx_revindex(struct multi_pack_index *m)
 	if (m->revindex_data)
 		return 0;
 
+	trace2_data_string("load_midx_revindex", the_repository,
+			   "source", "rev");
+
 	get_midx_rev_filename(&revindex_name, m);
 
 	ret = load_revindex_from_disk(revindex_name.buf,