git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: blanet via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, blanet <bupt_xingxin@163.com>,
	Xing Xin <xingxin.xx@bytedance.com>
Subject: Re: [PATCH] midx: disable replace objects
Date: Sun, 7 Apr 2024 10:16:28 -0400	[thread overview]
Message-ID: <ZhKqvA1NQwrVfnfE@nand.local> (raw)
In-Reply-To: <pull.1711.git.1712495507815.gitgitgadget@gmail.com>

On Sun, Apr 07, 2024 at 01:11:47PM +0000, blanet via GitGitGadget wrote:
> From: Xing Xin <xingxin.xx@bytedance.com>
>
> We observed a series of clone failures arose in a specific set of
> repositories after we fully enabled the MIDX bitmap feature within our
> Codebase service. These failures were accompanied with error messages
> such as:
>
>   fatal: did not receive expected object ...
>   fatal: fetch-pack: invalid index-pack output
>
> Temporarily disabling the MIDX feature eliminated the reported issues.
> After some investigation we found that all repositories experiencing
> failures contain replace references, which seem to be improperly
> acknowledged by the MIDX bitmap generation logic.

I was suspicious that this might be related to the MIDX or MIDX bitmap,
but noticed something curious upon digging in. Applying the following on
top of your patch:

--- 8< ---
diff --git a/t/t5326-multi-pack-bitmaps.sh b/t/t5326-multi-pack-bitmaps.sh
index 5e4cdef6a8..8543f8d097 100755
--- a/t/t5326-multi-pack-bitmaps.sh
+++ b/t/t5326-multi-pack-bitmaps.sh
@@ -451,9 +451,7 @@ test_expect_success 'do not follow replace objects for MIDX bitmap' '
 		git rev-list --objects --no-object-names $B |sort >expected &&

 		git replace $A $C &&
-		git repack -ad &&
-		git multi-pack-index write --bitmap &&
-		git rev-list --objects --no-object-names --use-bitmap-index $B |sort >actual &&
+		git rev-list --objects --no-object-names $B |sort >actual &&
 		test_cmp expected actual
 	)
 '
--- >8 ---

, I can still produce the failure that you are seeing here. So I suspect
that while it's entirely possible that there is a bug in the MIDX/bitmap
code, that this test is not exercising it.

I think the first step to demonstrate a bug in the MIDX/bitmap machinery
would be to provide a reproducer that fails only when using a MIDX
and/or bitmap.

> @@ -273,6 +274,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
>  	};
>  	struct option *options = parse_options_concat(builtin_multi_pack_index_options, common_opts);
>
> +	disable_replace_refs();
> +

Supposing for a moment that this issue is in the MIDX, we know that
regardless of what replace refs might be in place, the MIDX should only
be storing the objects that are in the packs being indexed, not the
objects which are their replacements.

Are we storing objects in the MIDX that are replacements? Looking
at midx.c::fill_pack_entry(), I think the answer is "no", since we're
looking up packed objects by calling nth_packed_object_id(), which is
just a table read into the .idx, all of which is beneath the level of
replace refs.

> @@ -434,6 +434,30 @@ test_expect_success 'tagged commits are selected for bitmapping' '
>  	)
>  '
>
> +test_expect_success 'do not follow replace objects for MIDX bitmap' '
> +	rm -fr repo &&
> +	git init repo &&
> +	test_when_finished "rm -fr repo" &&
> +	(
> +		cd repo &&
> +
> +		test_commit A &&
> +		A=$(git rev-parse HEAD) &&

It's possible that much of this will be moot if the current test gets
rewritten, but here are a couple of suggestions for writing tests in
Git's suite:

- test_commit will create a tag for you, so there is no need to store
  "$A", "$B", and "$C".

> +		test_commit B &&
> +		B=$(git rev-parse HEAD) &&
> +		git checkout --orphan=orphan $A &&
> +		test_commit orphan &&
> +		C=$(git rev-parse HEAD) &&
> +		git rev-list --objects --no-object-names $B |sort >expected &&

- We do not allow Git invocations on the left-hand side of a pipe, since
  doing so will squelch its exit code. Instead, try:

    git rev-list --objects --no-object-names B >expect.raw &&
    sort expect.raw >expect &&

Thanks,
Taylor


  reply	other threads:[~2024-04-07 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-07 13:11 [PATCH] midx: disable replace objects blanet via GitGitGadget
2024-04-07 14:16 ` Taylor Blau [this message]
2024-04-07 18:02   ` Taylor Blau
2024-04-07 18:04     ` Taylor Blau
2024-04-08  5:45     ` [External] " 鑫邢
2024-04-08  5:26 ` [PATCH v2] " blanet via GitGitGadget
2024-04-17 19:34   ` Junio C Hamano
2024-04-18 13:22     ` Taylor Blau
2024-04-18 16:06       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZhKqvA1NQwrVfnfE@nand.local \
    --to=me@ttaylorr.com \
    --cc=bupt_xingxin@163.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=xingxin.xx@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).