git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org,  Jeff King <peff@peff.net>,
	 Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH v2 0/2] upload-pack: don't ACK non-commits repeatedly
Date: Fri, 05 Sep 2025 14:39:57 -0700	[thread overview]
Message-ID: <xmqq4itg37f6.fsf@gitster.g> (raw)
In-Reply-To: <20250905-b4-pks-upload-pack-repeated-non-commit-acks-v2-0-d2e67f3cb94c@pks.im> (Patrick Steinhardt's message of "Fri, 05 Sep 2025 08:18:00 +0200")

Patrick Steinhardt <ps@pks.im> writes:

> Hi,
>
> this patch series addresses an issue with storing duplicate object IDs
> sent by the client in git-upload-pack(1). If the client sends repeated
> "have" lines for an object ID that doesn't refer to a commit, then we
> end up storing that object ID repeatedly in the `have_obj` array. This
> leads to sending out repeated "ACK"s for the same object.
>
> The series applies on top of "maint" at c44beea485 (Git 2.51,
> 2025-08-17).
>
> Changes in v2:
>   - Change ordering so that we always mark parents of already-seen
>     commits as `THEY_HAVE`. The first version was _probably_ fine, but
>     I don't feel too comfortable with a "probably".
> ...
> 2:  1544160961 ! 2:  11e32bf5e6 upload-pack: don't ACK non-commits repeatedly in protocol v2
>     @@ upload-pack.c: static void create_pack_file(struct upload_pack_data *pack_data,
>       
>       	if (!o)
>       		die("oops (%s)", oid_to_hex(oid));
>     -+
>     -+	if (o->flags & THEY_HAVE)
>     -+		return 0;
>     -+	o->flags |= THEY_HAVE;
>      +
>       	if (o->type == OBJ_COMMIT) {
>       		struct commit_list *parents;
>     @@ upload-pack.c: static int do_got_oid(struct upload_pack_data *data, const struct
>      -	}
>      -	return 0;
>      +
>     ++	if (o->flags & THEY_HAVE)
>     ++		return 0;
>     ++	o->flags |= THEY_HAVE;
>     ++
>      +	add_object_array(o, NULL, &data->have_obj);
>      +	return 1;
>       }

OK.  So we used to do the "if the object were marked already, do not
bother adding it to the have_obj array again" only for commits, but
now we do not special case commits for that part of the logic.
Everybody is protected against getting added twice.

We still do special case commits by marking their direct parents
(but we do not add them to the have_obj array) as before, because we
want to play conservatively.

Which makes sense.

Thanks, will queue.

      parent reply	other threads:[~2025-09-05 21:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  4:54 [PATCH 0/2] upload-pack: don't ACK non-commits repeatedly Patrick Steinhardt
2025-09-03  4:54 ` [PATCH 1/2] t5530: modernize tests Patrick Steinhardt
2025-09-04  4:10   ` Junio C Hamano
2025-09-03  4:54 ` [PATCH 2/2] upload-pack: don't ACK non-commits repeatedly in protocol v2 Patrick Steinhardt
2025-09-04  4:23   ` Junio C Hamano
2025-09-04 12:42     ` Patrick Steinhardt
2025-09-04 16:37       ` Junio C Hamano
2025-09-05  6:11         ` Patrick Steinhardt
2025-09-05  6:18 ` [PATCH v2 0/2] upload-pack: don't ACK non-commits repeatedly Patrick Steinhardt
2025-09-05  6:18   ` [PATCH v2 1/2] t5530: modernize tests Patrick Steinhardt
2025-09-05  6:18   ` [PATCH v2 2/2] upload-pack: don't ACK non-commits repeatedly in protocol v2 Patrick Steinhardt
2025-09-08 16:51     ` Jeff King
2025-09-05 21:39   ` Junio C Hamano [this message]

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

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

  git send-email \
    --in-reply-to=xmqq4itg37f6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /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.
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 NNTP newsgroup(s).