You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add opt-in safe checkpoint polling for MongoDB (#118) - #121
Part of #118 and NEventStore/NEventStore#425. Draft dependency: the dependencies/NEventStore gitlink points temporarily to d06da7c from core PR #555. Before merging this PR, pin the merged core revision and rerun CI. Before publishing, set the adapter’s NuGet minimum to the released core version containing ISafeCheckpointPolling and verify a clean package-only consumer. No package is published here.
Behavior
Both polling paths capture the global tip and read active commits in (after, tip]. No new write operations, transactions, locks, stored fields, or changes to legacy reads.
Safe polling is opt-in on standalone MongoDB and replica sets with an unsharded Commits collection. Every writer must use the built-in generator, and cleanup must retain the Prevent EmptyRecycleBin from allowing checkpoint ID reuse #117 markers. Replica-set polling requires normal discovery, primary majority reads, and journaled majority writes. Set EnableSafeCheckpointPolling = true on either topology. The engine discovers the topology during index initialization and fills only the missing replica-set defaults before constructing the allocator. Explicit settings and virtual overrides are preserved; incompatible settings disable safe polling rather than falling back. The engine now caches eligibility after successful initialization; replica-set elections do not invalidate it, while a deployment-type or settings change requires a new engine. A single causally consistent session binds the replica-set tip to the read cursor. Sharded Commits stays on standby in Shard commits collection? #57; sharded topologies and recycle-bin reads remain unqualified. Standalone reads still do not wait for journal durability.
The regression pauses a writer after allocation and before insert. The incrementing generator reproduces the legacy miss (2 before 1); the built-in generator competes for the same ID and retries beyond the saved checkpoint. Tests cover sync and async, all-bucket and bucket-scoped reads, fresh-reader resume, and advancement past retired IDs. See the configuration notes.
When explicitly enabled but unsupported, the adapter logs the first incompatible setting once at initialization. Direct safe reads include the same reason in NotSupportedException.
Latest diagnostics revision: 13 focused tests passed per topology, including exact rejection reasons; the .NET Framework 4.7.2 build also passed. Compose config validated; all 17 focused tests passed using the same bootstrap and health check outside Docker.
Before the Docker and diagnostics follow-ups: 2,122 passed on a three-member MongoDB 7.0.45 replica set and 2,118 passed on standalone (.NET 10 / Driver 3.14.0; zero skipped), including actual elections and rollback/reuse. The new guard regression observed no commit collection inspections after initialization. The .NET Framework 4.7.2 provider and tests compiled.
Replica-set qualification: .NET 10 / Driver 3.14.0 on three MongoDB 7.0.45 members, 2,118 passed, zero skipped. This includes sync and async resume after forced elections plus verified rollback/reuse cases. The new GitHub Actions replica-set jobs run the full suite with both supported driver pins.
.NET Framework 4.7.2 provider and tests compiled; the runtime suite was not run on .NET Framework.
Six initial regressions were red before the capability was implemented. The raw read assertions reached the expected checkpoint miss before the capability check failed.
Co-authored by Alessandro Giorgetti and Codex (OpenAI).
AGiorgetti
changed the title
Add opt-in safe checkpoint polling for standalone MongoDB (#118)
Add opt-in safe checkpoint polling for MongoDB (#118)
Dec 2, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Safe polling accepts a generator bound to another collection, risking permanently missed commits, and new CI action references remain vulnerable to mutable version tags.
A caller-supplied generator of the built-in type can read a different collection or use different concerns. Keep it available for legacy operations, but never advertise safe polling with it.
Co-authored-by: Codex <codex@openai.com>
The new tests do not exercise this write-concern rejection: the explicit-settings case fails earlier on read preference, and the virtual-override case fails on read concern. Add replica-set cases with primary/majority reads and either unjournaled majority writes or journaled w:1 writes. Assert false capability and rejection through both polling paths so these rollback-safety guards cannot regress unnoticed.
Validate the effective insert write concern before creating any collection handles, even if safe polling is disabled. Optimistic concurrency and checkpoint retries require the server's duplicate-key response. Keep the existing virtual extension point and acknowledged defaults.
Co-authored-by: Codex <codex@openai.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new checkout, setup-dotnet, and upload-artifact actions use mutable tags rather than immutable commit SHAs, allowing CI code to change without review.
Assert the configuration exception without requiring the driver to echo the URI. Select rollback participants from the live replica set, so seed aliases cannot misidentify the primary.
Co-authored-by: Codex <codex@openai.com>
The preceding failover case can leave a former primary recovering. Wait for one primary and two secondaries before pausing replication.
Co-authored-by: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #118 and NEventStore/NEventStore#425. Draft dependency: the
dependencies/NEventStoregitlink points temporarily tod06da7cfrom core PR #555. Before merging this PR, pin the merged core revision and rerun CI. Before publishing, set the adapter’s NuGet minimum to the released core version containingISafeCheckpointPollingand verify a clean package-only consumer. No package is published here.Behavior
Both polling paths capture the global tip and read active commits in
(after, tip]. No new write operations, transactions, locks, stored fields, or changes to legacy reads.Safe polling is opt-in on standalone MongoDB and replica sets with an unsharded
Commitscollection. Every writer must use the built-in generator, and cleanup must retain the Prevent EmptyRecycleBin from allowing checkpoint ID reuse #117 markers. Replica-set polling requires normal discovery, primary majority reads, and journaled majority writes. SetEnableSafeCheckpointPolling = trueon either topology. The engine discovers the topology during index initialization and fills only the missing replica-set defaults before constructing the allocator. Explicit settings and virtual overrides are preserved; incompatible settings disable safe polling rather than falling back. The engine now caches eligibility after successful initialization; replica-set elections do not invalidate it, while a deployment-type or settings change requires a new engine. A single causally consistent session binds the replica-set tip to the read cursor. ShardedCommitsstays on standby in Shard commits collection? #57; sharded topologies and recycle-bin reads remain unqualified. Standalone reads still do not wait for journal durability.The regression pauses a writer after allocation and before insert. The incrementing generator reproduces the legacy miss (2 before 1); the built-in generator competes for the same ID and retries beyond the saved checkpoint. Tests cover sync and async, all-bucket and bucket-scoped reads, fresh-reader resume, and advancement past retired IDs. See the configuration notes.
When explicitly enabled but unsupported, the adapter logs the first incompatible setting once at initialization. Direct safe reads include the same reason in
NotSupportedException.The replica-set CI jobs and local developers use the same Docker Compose fixture.
Verification
Co-authored by Alessandro Giorgetti and Codex (OpenAI).