Repository navigation
delta-islands: revisit trees with new delta marks - #2343
Open
derrickstolee wants to merge 1 commit into
Open
derrickstolee wants to merge 1 commit into
derrickstolee wants to merge 1 commit into
Conversation
derrickstolee
force-pushed
the
delta-islands
branch
from
November 30, 2026 19:22
d664b38 to
80605f6
Compare
Author
|
/submit |
|
Submitted as pull.2343.git.1796066735611.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
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. This change includes some test cases that demonstrate this problem, and several of the modes fail without the accompanying code change. These examples were discovered while working with the --path-walk option as integrated with delta islands in 7e6de2a (pack-objects: support `--delta-islands` with `--path-walk`, 2026-06-21), but that option only exposed an existing failure within the marking algorithm. At least one of the new tests exposes a failure without --path-walk. The issue is not just about different path names, but about appearing at paths of different depth. For example, a tree appearing at a/b/ can be visited with one set of marks as supplied from the trees at a/ while later being seen at x/y/z/ with different marks supplied by objects at x/y/. To fix this issue, we need to potentially reprocess a tree and everything it can reach when we discover an update to the delta island marks. This can lead to massive recomputation with certain data shapes that revisit objects from different paths. This seems unlikely to happen often in realistic scenarios, but is unavoidable without topologically sorting the entire object graph before distributing marks. Concretely, update set_island_marks() to report whether the object gained any bits in the process. Use a depth-priority queue to revisit trees that have new marks. We need to be careful to avoid adding duplicates to the queue without replicating the SEEN bit. This depth heuristic is only to prioritize a breadth-first-search, handling root trees before the next set of trees, and so on. This is intended to maximize the possibility of seeing all links to an object before visiting that object. The first-seen-depth problem was identified during the original delta-island review [1]: SEEN prevents revisiting shared trees, so their recorded depths need not give a topological ordering. That discussion illustrated missed delta opportunities. Incomplete marks can also allow unwanted cross-island deltas, as acknowledged for a related root-depth bug in 3949053 (pack-objects: fix off-by-one in delta-island tree-depth computation, 2018-11-20) [2]. Later discussion emphasized real fork-network results and the difficulty of constructing focused corner-case tests [3]. [1] https://lore.kernel.org/git/20180727130229.GB18599@sigill.intra.peff.net/ [2] https://lore.kernel.org/git/20181120095053.GC22742@sigill.intra.peff.net/ [3] https://lore.kernel.org/git/20181120113423.GA29319@sigill.intra.peff.net/ Using p5305's historical-fork island selection, with --no-path-walk, bitmap reads disabled, --window=0, --compression=0, and stored deltas reusable, gives these old-to-fixed command times and tree visits: Time (s) Tree visits git/git 8.08 -> 8.24 162,791 -> 162,795 nodejs/node 9.85 -> 10.14 238,723 -> 239,837 microsoft/fluentui 4.13 -> 4.24 287,056 -> 287,136 torvalds/linux 176.28 -> 170.73 6,888,020 -> 6,888,085 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. Assisted-by: GPT-6.1 Sol Signed-off-by: Derrick Stolee <stolee@gmail.com>
derrickstolee
force-pushed
the
delta-islands
branch
from
November 30, 2026 19:37
80605f6 to
d46bfc2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discovered while working on a real application of delta islands and the --path-walk feature.
cc: gitster@pobox.com
cc: peff@peff.net
cc: ttaylorr@openai.com
cc: newren@gmail.com