Skip to content

Add exact slot clearing for variable deduplication - #10107

Merged
michaelstaib merged 6 commits into
mainfrom
mst/variable-dedup-clear
Jul 14, 2026
Merged

Add exact slot clearing for variable deduplication#10107
michaelstaib merged 6 commits into
mainfrom
mst/variable-dedup-clear

Conversation

@michaelstaib

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 13, 2026 08:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances FetchResultStore’s variable deduplication table so it can be safely reused across calls by clearing only the slots that were written, and adds regression tests covering reuse, growth+reuse, and exception recovery.

Changes:

  • Enable tracked-slot mode for VariableDedupTable and use AddTracked so Clear() can clear only previously written slots.
  • Ensure VariableDedupTable is disposed when FetchResultStore is disposed.
  • Add tests validating tracked-slot clearing behavior across reuse, growth, and failure scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs Adds tracked-slot clearing to the variable dedup table and disposes it with the store.
src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Results/FetchResultStoreTests.cs Adds regression tests to validate dedup-table reuse, growth+reuse, and healing after exceptions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2514 to +2516
public void AddTracked(int hash, int index, int location, int length)
{
var bucket = hash & 0x7FFFFFFF & (_bucketCount - 1);
Comment on lines +1721 to +1724
private static string[] FindCollidingStringValues(string key, int count)
{
const int bucketCount = 16;
var valuesByBucket = new List<string>?[bucketCount];
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (79/79)

File Covered Changed Patch %
…/src/Fusion.Execution/Execution/Results/FetchResultStore.cs 79 79 100.0% 🟢

Project coverage: 53.7% (230725/429537 lines)

@michaelstaib michaelstaib changed the title dd exact slot clearing for variable deduplication Add exact slot clearing for variable deduplication Jul 13, 2026
@michaelstaib
michaelstaib merged commit 45bc325 into main Jul 14, 2026
6 of 7 checks passed
@michaelstaib
michaelstaib deleted the mst/variable-dedup-clear branch July 14, 2026 23:03
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.

2 participants