From: Taylor Blau <ttaylorr@openai.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 0/4] send-pack: introduce a `no-ref-delta` capability
Date: Sat, 18 Jul 2026 16:02:40 -0500 [thread overview]
Message-ID: <alvp8KsZPKqCyqma@com-79390> (raw)
In-Reply-To: <20260718090527.GA30873@coredump.intra.peff.net>
On Sat, Jul 18, 2026 at 05:05:27AM -0400, Jeff King wrote:
> On Tue, Jul 14, 2026 at 02:58:36PM -0700, Taylor Blau wrote:
>
> > > So I have the feeling that there's some ulterior motive, or that this is
> > > part of a larger system, but I don't quite understand what it is. And so
> > > it's hard to say whether this is a sensible approach.
> >
> > The implementation motivating this is write-through in the sense that it
> > first parses and spools the incoming pack, then replays those exact
> > bytes together with the same ref commands to an upstream receive-pack.
>
> OK, that kind-of makes sense. But is that intermediate layer not
> indexing at all? As in, it does not know which OIDs are present in the
> incoming pack?
It does. The receive path computes object IDs while ingesting and
validating the incoming pack. The index I was referring to is the
durable index for the stored pack, not what we would compute in memory
during receipt of the incoming push. That durable index is built
asynchronously after the push is accepted.
> It sounds like you _do_ index it based on this:
>
> > In retrospect, I don't think the cover letter distinguishes this well.
> > The pack that we receive over the wire is stored byte-for-byte as an
> > immutable artifact, and the per-object physical index is derived
> > asynchronously. That indexer is designed to operate in a single pass
> > forward over the pack.
>
> So I can see how REF_DELTA makes a single streaming pass harder. But can
> you actually do a single pass even with OFS_DELTA? You'll need to look
> at earlier bytes in order to resolve each new object. And possibly
> recursively. So you must maintain random access to the new pack data,
> and you must maintain some kind of in-memory structure, at least for
> each delta family (especially if you want to avoid re-generating deltas
> over and over as you satisfy a long chain).
"Single pass" here means one forward read of the pack entries, with
random access to a disk-backed store of already-resolved objects. But...
> I.e., I am having trouble understanding what makes REF_DELTA more
> expensive than OFS_DELTA, either in terms of random-access to the pack
> or in terms of indexing memory. It's more _complicated_ for sure,
> though.
...by restricting objects to only be encoded as OFS_DELTA, we can always
load the base object knowing that it has already been processed. That
trivially permits you to avoid holding the entire pack in resident
memory, since you are able to look-up the right chunk(s) as needed.
If you have REF_DELTAs, the story is much more complicated. In that
case, you must be prepared to keep unresolved deltas around until the
base appears, which may be very far ahead in the pack. Alternatively,
you could build a map of pack positions by OID, but even in that case
you have to keep a pending work queue to be prepared for deltas whose
base object we have not yet seen.
> That doesn't seem all _that_ compelling to me. I think the more
> interesting thing is that in the worst case, a single REF_DELTA can kill
> your pipeline entirely (assuming you are trying to do as much CPU-heavy
> resolving work as possible while the pack is transferring). Imagine a
> pack like this:
>
> 0: REF_DELTA(abcd)
> 1: OFS_DELTA(offsetof(0))
> 2: OFS_DELTA(offsetof(1))
> 3: OFS_DELTA(offsetof(2))
> ...
> N: base object with hash "abcd"
>
> You can't resolve a single delta until you hit object N, after which you
> must then resolve each of 0..N-1 sequentially because they all depend on
> each other.
>
> The problem there is not REF_DELTA itself, but the fact that REF_DELTA
> allows you to place a base after the delta which depends on it.
Exactly.
> If _that_ is your main concern, would it be worth a tighter capability
> advertisement that insists that bases come before their deltas (if they
> are in the pack at all)? We already generate packs that way by default,
> and it would really just give the server a license to reject these
> non-standard packs.
That would address the ordering problem, but is weaker than the format
restriction this receiver wants. Even a backward REF_DELTA requires an
OID-to-entry lookup, whereas the retained pack's reconstruction metadata
is addressed by offset alone. Supporting that is possible, of course,
but adds another way to locate a base.
> But now I'm about 3 levels deep in guessing at your real issues, so I'll
> stop for now and see how close I got. ;)
I think you got pretty close ;-).
Thanks,
Taylor
prev parent reply other threads:[~2026-07-18 21:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 1:11 [PATCH 0/4] send-pack: introduce a `no-ref-delta` capability Taylor Blau
2026-07-13 1:14 ` Taylor Blau
2026-07-14 7:45 ` Jeff King
2026-07-14 21:58 ` Taylor Blau
2026-07-18 9:05 ` Jeff King
2026-07-18 21:02 ` Taylor Blau [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=alvp8KsZPKqCyqma@com-79390 \
--to=ttaylorr@openai.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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