Skip to content

fix(journaling): preserve snapshot reference scopes - #10800

Merged
ReubenBond merged 7 commits into
dotnet:mainfrom
ReubenBond:rb-fix-journaling-preserve-snapshot-referen
Aug 24, 2026
Merged

ReubenBond merged 7 commits into
dotnet:mainfrom
ReubenBond:rb-fix-journaling-preserve-snapshot-referen

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 24, 2026

Copy link
Copy Markdown
Member

OrleansBinary collection snapshots encode each list, queue, and set item with a fresh serializer session. Dictionary commands encode each key/value entry in one fresh session, preserving references within the entry while isolating separate commands and entries. Snapshot replay previously retained one reader reference scope across the entire snapshot, allowing reference identifiers from an earlier item or entry to affect a later one.

Reset the reader serializer session around each list, queue, and set item. For dictionaries, encode and decode each key/value pair within one entry-level session and reset between entries, matching direct WriteSet behavior. The shared WriteValue/ReadValue helpers retain concise names for single-value scopes, while the dictionary codec handles its two-field entry scope privately.

Golden snapshot payload tests specify the collection format and verify aliases within values. Dictionary regressions verify references are preserved between each key and value while separate snapshot entries remain isolated. The change remains limited to OrleansBinary command encoding and decoding.

Reset the Orleans serializer reader session between independently encoded snapshot values while retaining each value's internal aliases and existing wire bytes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617

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 fixes OrleansBinary snapshot replay for journaling collections by ensuring the reader’s serializer reference/type tracking is reset after each independently-encoded snapshot value, preventing reference identifiers from one value from influencing subsequent values while keeping the wire bytes unchanged.

Changes:

  • Reset the reader serializer session after decoding each snapshot element (and dictionary key/value) to match per-value encoding scopes.
  • Update dictionary/list/queue/set snapshot replay paths to use the new “independent value” read helper.
  • Add golden-payload regression tests which pin snapshot payload bytes and verify alias (intra-object reference) preservation during replay.
Show a summary per file
File Description
test/Orleans.Journaling.Tests/OrleansBinaryCommandCodecTests.cs Adds golden-payload tests for dictionary/list/queue/set snapshots and validates alias preservation during replay.
src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableSetCommandCodec.cs Switches set snapshot replay to read each item with an independent serializer reference scope.
src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableQueueCommandCodec.cs Switches queue snapshot replay to read each item with an independent serializer reference scope.
src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableListCommandCodec.cs Switches list snapshot replay to read each item with an independent serializer reference scope.
src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableDictionaryCommandCodec.cs Switches dictionary snapshot replay to read each key and value with independent serializer reference scopes.
src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryCommandCodecHelpers.cs Introduces ReadIndependentValue which resets the reader session after decoding a value.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Code coverage

77.48% line coverage - 97,316 / 125,601 lines

Coverage details

Pair every encoded value with an explicit independent reader scope, including dictionary keys and values, and remove the shared-scope helper.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Copilot AI review requested due to automatic review settings August 24, 2026 18:14

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.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

Keep per-value serializer-session isolation as the sole helper behavior and use concise WriteValue and ReadValue names.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Copilot AI review requested due to automatic review settings August 24, 2026 18:29

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.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings August 24, 2026 18:36

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.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Share serializer references between each dictionary key and value while resetting the session between commands and snapshot entries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Keep command zero as the single dictionary set format and rely on entry-level serializer scopes for both commands and snapshots.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Copilot AI review requested due to automatic review settings August 24, 2026 18:50

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.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread test/Orleans.Journaling.Tests/OrleansBinaryCommandCodecTests.cs
Approve the entry-scoped dictionary payloads used by the existing OrleansBinary Verify tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Copilot AI review requested due to automatic review settings August 24, 2026 19:43

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.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@ReubenBond
ReubenBond merged commit 3e92251 into dotnet:main Aug 24, 2026
76 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-journaling-preserve-snapshot-referen branch August 24, 2026 20:42
This was referenced Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants