Skip to content

[Fusion] Keep identical lookups apart when entity reuse can serve the deeper one - #10661

Merged
michaelstaib merged 4 commits into
mainfrom
mst/entity-reuse-lookup-splitting
Oct 22, 2026
Merged

michaelstaib merged 4 commits into
mainfrom
mst/entity-reuse-lookup-splitting

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

The planner used to merge identical entity lookups at different depths into one request, so a lookup that could run early had to wait for the deepest one.
When entity reuse can serve these lookups, they now stay apart: the shallow lookup runs early and each deeper lookup waits for the one above it.
The deeper lookup then reuses the entities the earlier lookup already fetched, so it requests fewer entities or none at all.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

95.0% of changed lines covered (302/318)

File Covered Changed Patch %
…/Execution/Nodes/Serialization/JsonOperationPlanParser.cs 9 12 75.0% 🔴
…/src/Fusion.Execution/Execution/Nodes/OperationDefinition.cs 15 18 83.3% 🟡
…/Execution/Results/EntityReuseCandidateMap.cs 40 43 93.0% 🟡
…/Planning/OperationPlanner.BuildExecutionTree.cs 175 181 96.7% 🟡
…/Execution/Nodes/Serialization/JsonOperationPlanFormatter.cs 30 31 96.8% 🟡
…/Fusion.Execution/Execution/FusionRequestExecutorManager.cs 2 2 100.0% 🟢
…/Execution/Nodes/Serialization/YamlOperationPlanFormatter.cs 18 18 100.0% 🟢
…/src/Fusion.Execution/Execution/Results/FetchResultStore.cs 1 1 100.0% 🟢
…/src/Fusion.Execution/Planning/OperationPlanner.Defer.cs 6 6 100.0% 🟢
…/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs 1 1 100.0% 🟢
…/src/Fusion.Execution/Planning/OperationPlannerOptions.cs 5 5 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "0561a371dbb42f4aa26fdd6828023cc3a72bd743",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Serialization/JsonOperationPlanParser.cs", "ranges": [[558, 560]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/OperationDefinition.cs", "ranges": [[164, 166]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/EntityReuseCandidateMap.cs", "ranges": [[586, 588]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs", "ranges": [[1421, 1424], [2420, 2420], [2433, 2433]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Serialization/JsonOperationPlanFormatter.cs", "ranges": [[535, 535]] }
  ]
}

Project coverage: 59.3% (314983/531458 lines)

… deeper one

The planner merged structurally identical lookups regardless of their
dependency depth, so a lookup that could run early waited for the deepest
one. When the lookup can take its entities from the result, identical
lookups at different depths now stay apart and each deeper lookup depends
on the next shallower one, so entity reuse serves it from that result.

OperationPlannerOptions.EnableEntityReuseSplitting turns this off and
FusionOptions.EnableEntityReuse = false disables it as well. Plans change,
so the planner version moves to 2.6.0.
…eaf copy

An interface target added a rejected offset entry without reserving its offset
segment, so the next concrete duplicate failed to grow the offset buffer.
@michaelstaib
michaelstaib force-pushed the mst/entity-reuse-lookup-splitting branch from 8b5df2f to 2a5a310 Compare October 22, 2026 20:06
…ipped or fails

The dependency that orders a deeper lookup after the identical shallower one is
now optional, so it only delays the deeper lookup. The planner and the plan
parser derive it from the lookups being identical, so the plan format is
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant