Repository navigation
fix(firestore): preserve atomic row membership reads - #11400
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation preserves snapshot consistency and is covered by protocol and concurrency tests.
Review effort: Balanced
Findings: None
What changed in this PR
Makes Firestore point membership reads atomic by binding the version and silo documents to one transactional snapshot.
Changes:
- Executes
ReadRowAsyncbatch reads within a retryable Firestore transaction. - Extends protocol tests for transaction selectors, retries, failures, and cancellation.
- Improves concurrent-read diagnostics by identifying the failing operation.
| File | Description |
|---|---|
src/Google/Orleans.Clustering.Firestore/FirestoreMembershipTable.cs |
Makes two-document row reads transactional. |
test/Extensions/Orleans.Clustering.Firestore.Tests/FirestoreMembershipHeartbeatTests.cs |
Validates transactional reads and lazy streamed-response races. |
test/Extensions/Orleans.Clustering.Firestore.Tests/FirestoreMembershipTableTests.cs |
Adds operation-specific atomicity failure diagnostics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code coverage
Report-only conclusion: regressed. The current-main baseline is commit 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 |
(cherry picked from commit 44b9905) Upstream-PR: dotnet#11400 Upstream-Commit: 44b9905
Fixes #11397.
Problem
#11311 replaced the transactional point read with an unbound BatchGetDocuments stream. Under concurrent membership updates, the version document and silo row can be returned from different committed states. #11342 restored transaction protection for full-table reads but left ReadRowAsync exposed.
Solution
Run the two-document ReadRowAsync batch inside a Firestore transaction, keeping one BatchGetDocuments request per attempt while binding both documents to one serializable snapshot. Update the protocol mock to stream unbound responses lazily so it can reproduce a torn view, verify transactional selectors and retries, and identify the failing read path in emulator stress diagnostics.
Rationale
A transaction supplies the snapshot boundary which an unbound strongly consistent batch does not provide across streamed responses. Firestore retries the read when a concurrent canonical update changes its read set, preserving the membership invariant that the table version and row state come from the same commit.
Microsoft Reviewers: Open in CodeFlow