Git development
 help / color / mirror / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Elijah Newren <newren@gmail.com>,
	Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, peff@peff.net,
	ttaylorr@openai.com
Subject: Re: [PATCH] delta-islands: revisit trees with new delta marks
Date: Wed, 2 Dec 2026 14:53:01 -0500	[thread overview]
Message-ID: <6bcf9997-068e-45f3-b737-9df430671de1@gmail.com> (raw)
In-Reply-To: <CABPp-BEzyAq6a=uq9-sOsAXFYjHdrga99+QauGxbkkTnOjLaGw@mail.gmail.com>

On 12/2/2026 2:14 PM, Elijah Newren wrote:
> On Mon, Nov 30, 2026 at 11:25 AM Derrick Stolee via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Derrick Stolee <stolee@gmail.com>
>>
>> When exploring the object graph to group objects into delta-islands,
>> some trees and blobs can be visited from one path and then revisited
>> later from another. If those two visits come from objects with different
>> delta marks, then the final mark of the visited object should be the
>> union of those marks. Instead, some cases only have the first marks as
>> we don't reprocess objects marked with SEEN. This gets worse for objects
>> recursively reachable from that object.
...
>> It's possible that a true integration of delta islands with path-walk
>> would help here, having the path-walk API compute the delta island marks
>> as we traverse objects in path-based groups. Such an implementation
>> would need to allow for objects to be readded to groups when their delta
>> marks are updated while avoiding multiple emissions of the object from
>> the API. Such a large rework of the delta island computation is avoided
>> for now, as we can reproduce the error with the existing implementation.
> 
> I had difficulty discerning the impact and motivation of the bug you
> are trying to fix, possibly because I only know a little about delta
> islands.  There is one paragraph that states it ("unwanted
> cross-island deltas"), but it reads as history rather than motivation,
> so I missed it at first.  Would it make sense to include the
> motivation near the top of the commit message?  I asked AI, and it
> told me...
> 
> ```
> Delta islands ensure that an object is only stored as a delta against
> a base that is reachable from every island containing the object, so
> that serving any one fork can reuse the on-disk delta instead of
> breaking it and searching for a new one on the fly.
> 
> However, island marks can be incomplete. resolve_tree_islands()
> propagates each tree's marks to its children once, in order of the
> depth at which the tree was first seen. A tree shared at different
> depths (e.g. seen at a/b/ and at x/y/z/) can therefore have its marks
> propagated before a parent from another island adds to them, and the
> late-arriving marks never reach the trees and blobs below it. An
> object missing marks looks like it belongs to fewer islands, so it can
> be deltified against a base that some of its islands cannot reach,
> reintroducing the expensive delta-breaking that islands exist to
> prevent. When the base is the one missing marks, valid deltas are
> instead rejected, making packs larger.
> ```

The base motivation of using delta islands is about avoiding delta
expansion and recompression during clones and fetches. By grouping
certain tip commits into "reachability categories" (say, refs for
each fork in a network) we can avoid having delta bases outside of
a typical clone in that "category".

I think [1] is still the best description of this mechanism.

[1] https://blog.github.com/open-source/git/counting-objects/#the-performance-fix

There might also be interesting cases where we say that a "trunk"
ref is a certain category and other branches are still reachable but
a different island. That could present improvements for --single-branch
clones.

>> Assisted-by: GPT-6.1 Sol
>> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> 
> I think Signed-off-by is supposed to match the committer; you've used
> two different email addresses.

I noticed this in my submission and have prepared a version already with
the fix. I created this in the wrong local directory that had the wrong
email configured. Will fix in v2.

>> -static void set_island_marks(struct object *obj, struct island_bitmap *marks)
>> +static int set_island_marks(struct object *obj, struct island_bitmap *marks)
>>  {
>>         struct island_bitmap *b;
>>         khiter_t pos;
>> @@ -172,19 +173,23 @@ static void set_island_marks(struct object *obj, struct island_bitmap *marks)
>>                  */
>>                 marks->refcount++;
>>                 kh_value(island_marks, pos) = marks;
>> -               return;
>> +               return 1;
>>         }
>>
>> +       b = kh_value(island_marks, pos);
>> +       if (island_bitmap_is_subset(marks, b))
>> +               return 0;
>> +
>>         /*
>>          * We do have it. Make sure we split any copy-on-write before
>>          * updating.
>>          */
>> -       b = kh_value(island_marks, pos);
>>         if (b->refcount > 1) {
>>                 b->refcount--;
>>                 b = kh_value(island_marks, pos) = island_bitmap_new(b);
>>         }
>>         island_bitmap_or(b, marks);
>> +       return 1;
>>  }
> 
> You're now returning whether obj's marks changed.  Is it worth adding
> a comment above the function mentioning the meaning of the return
> value?

A doc-comment would be good now that this has a nonzero (non-error)
return value.

>>         if (progress)
>> -               progress_state = start_progress(r, _("Propagating island marks"), nr);
>> +               progress_state = start_progress(r, _("Propagating island marks"), 0);
> 
> We've changed from showing a percentage of completion to just a count
> of trees processed.  Since trees can be reprocessed, there's no
> reasonable total we can give, so this seems like a reasonable change.
> I'm curious if it's worth calling this out in the commit message.

It probably is. Can do.
> Looks good.

Thanks for the review!
-Stolee


      reply	other threads:[~2026-12-02 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 19:25 [PATCH] delta-islands: revisit trees with new delta marks Derrick Stolee via GitGitGadget
2026-12-02 19:14 ` Elijah Newren
2026-12-02 19:53   ` Derrick Stolee [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=6bcf9997-068e-45f3-b737-9df430671de1@gmail.com \
    --to=stolee@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=ttaylorr@openai.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox