Skip to content

fix(aws): preserve DynamoDB membership consistency - #11310

Merged
ReubenBond merged 9 commits into
dotnet:mainfrom
ReubenBond:rb-fix-dynamodb-membership-consistency
Sep 18, 2026
Merged

ReubenBond merged 9 commits into
dotnet:mainfrom
ReubenBond:rb-fix-dynamodb-membership-consistency

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

DynamoDB membership changes need atomic canonical row/table updates, complete row replacement, and coherent views across paginated reads. Cleanup needs to retain live members and respect recent starts, heartbeats, and suspicion votes when those values change concurrently.

This change uses a conditional full-row Put alongside a table-version update in one transaction, clearing removed suspicion data and validating the canonical row/table etags. A full-row replacement proceeds with those original canonical tokens after an owner heartbeat. The owning live silo writes IAmAliveTime using one unconditional, timestamp-only UpdateItem request with native cancellation and error propagation.

Full-table reads retain main's opening strongly consistent version read and paginated strongly consistent query. Canonical writes already stamp each member with the new table version atomically; reads reject queried versions or member stamps newer than the opening view. This yields a coherent canonical view using one point read per attempt. Record deserialization validates numeric membership tokens and recency attributes. Missing version history in either the point read or query surfaces immediately. Structured transaction cancellation reasons distinguish canonical contention from other failures.

Cleanup prunes only Dead member rows whose start time, heartbeat, and every suspicion vote precede the exact exclusive cutoff, preserving the table-version record by identity. Native per-row conditional deletes check Dead status, the canonical row etag, and the independently updated heartbeat. The row etag protects concurrent status/start/vote changes while cleanup retains the existing unversioned Dead-pruning behavior. Cleanup runs in groups of at most 25 in-flight deletes and owns every started request until completion. An internal shared-storage overload forwards cancellation to DeleteItemAsync.

Cluster-wide administrative deletion retains its separate scoped batch path. The shared batch-delete helper inspects UnprocessedItems and surfaces partial deletion as a contextual logged failure, preserving one native request per batch and existing cancellation behavior. This covers both the membership and reminder callers of that helper.

The focused SDK-mocked regressions cover heartbeat request shape/counts, successful canonical-token reuse after a heartbeat, atomic missing/stale-row and stale-table conflicts, malformed records, cleanup concurrency and conditions, tick-precision cutoffs, changes on either side of the version row during pagination, partial batch responses, and cancellation/error propagation. The separate prerequisite commit cherry-picks only the legacy cleanup-test preparation from #11308 (bede893d290a9035f196f4c3ed58213d102efc6c). Provider-wide conformance wiring remains a follow-up.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 17, 2026 22:38

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.

Copilot review overview

🟡 Changes recommended

Address the identified cleanup concurrency, malformed-row validation, version validation, and logging findings.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Hardens DynamoDB membership consistency, heartbeat handling, coherent reads, and cleanup behavior.

Changes:

  • Adds atomic membership updates with monotonic heartbeat preservation.
  • Improves paginated reads, error propagation, and cancellation handling.
  • Adds conditional cleanup operations and focused regression coverage.
File Summary
test/​Orleans.Runtime.Internal.Tests/​MembershipTests/​MembershipTableTestsBase.cs Updates cleanup expectations.
test/​Extensions/​Orleans.AWS.Tests/​MembershipTests/​DynamoDBMembershipTableUnitTests.cs Adds DynamoDB consistency and cleanup regression tests.
src/​AWS/​Shared/​Storage/​DynamoDBStorage.cs Adds cancellation-aware item deletion.
src/​AWS/​Orleans.Clustering.DynamoDB/​Membership/​DynamoDBMembershipTable.cs Implements membership updates, reads, heartbeat handling, and conditional cleanup.

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

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request Current main Variance
Lines 82.30% (112,647 / 136,877) 82.23% (112,504 / 136,817) +0.0684 pp
Branches 71.55% (32,526 / 45,459) 71.46% (32,432 / 45,383) +0.0873 pp

Report-only conclusion: improved.

The current-main baseline is commit 0f9537dde1 and uses the same reviewed coverage matrix.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

Copilot AI review requested due to automatic review settings September 18, 2026 14:15

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.

Copilot review overview

🟡 Changes recommended

Unresolved malformed DynamoDB attribute handling can cause infinite retries or unsafe cleanup deletion.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (3)

Copilot AI review requested due to automatic review settings September 18, 2026 15:08

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.

Copilot review overview

🟡 Changes recommended

Three unresolved DynamoDB membership and cleanup findings remain, including one critical issue.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 18, 2026 15:32

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.

Copilot review overview

🟡 Changes recommended

One critical and two moderate unresolved issues remain in DynamoDBMembershipTable.cs.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 18, 2026 15:52

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.

Copilot review overview

🟡 Changes recommended

A critical missing-version handling issue and a misleading propagated-error log message remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (2)

Copilot AI review requested due to automatic review settings September 18, 2026 16:09

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.

Copilot review overview

🔵 Needs a closer look

The broad concurrency, pagination, cleanup, and cancellation changes warrant final human review.

Review effort: Lite
Findings: None

Resolved since last review (2)

Copilot AI review requested due to automatic review settings September 18, 2026 17:22

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.

Copilot review overview

🔵 Needs a closer look

The broad consistency, concurrency, and cleanup changes warrant final human review.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 18, 2026 17:37

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.

Copilot review overview

🟢 Approval recommended

The reviewed changes and regression coverage address the stated DynamoDB consistency and reliability requirements with no unresolved blocking issues.

Review effort: Lite
Findings: None

@ReubenBond
ReubenBond merged commit 5267011 into dotnet:main Sep 18, 2026
73 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-dynamodb-membership-consistency branch September 18, 2026 21:38
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants