Pinned event-mongodb persistent visibility and checkpoint ordering boundaries
Parent: Change Data Capture Patterns · Published reference · snapshot 2026-11-02
↓ Facts as markdownall context files
Source-anchored research for Pinned event-mongodb persistent visibility and checkpoint ordering boundaries. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Structure and components
- The unit fixtures inspect constructor errors, options, status constants and index models. The integration fixtures separately cover append/fetch/ack, spaced ordering with checkpoints, Nack, visibility reclamation, statistics, purge, TTL-index presence, acknowledgement errors, and checkpoint round-trip/list/deletion. This reviewed fixture file contains no combined application-effect/checkpoint crash protocol or arbitrary concurrent-producer ordering fixture; these are fixture-source assertions, not an execution-result report. (medium confidence) [source 1] [source 2]
How it works
- CheckpointStore identity is eventName + ":" + consumerID. Load looks up that composite _id; Save uses ReplaceOne with an _id-only filter and upsert, replacing checkpoint and updated_at without checking monotonic progress or validating ObjectID syntax. Inference, colon-containing input pairs can share an identity because checkpointKey performs unescaped concatenation. (low confidence) [source]
- Ack filters by _id and event_name, sets status to acked and acked_at to time.Now(), and reports ErrMessageNotFound when nothing matches. The AppendFetchAck fixture asserts that an empty-checkpoint Fetch returns nothing after Ack. Neither the Ack predicate nor its update checks a claim owner or requires inflight status. (medium confidence) [source 1] [source 2]
Comparisons and alternatives
- Append generates an ObjectID before assigning time.Now() to timestamp and inserting the pending document; it returns the ObjectID hex string. Fetch sorts eligible documents by timestamp ascending, then _id ascending, but a nonempty checkpoint adds only _id > parsed ObjectID. A malformed checkpoint returns an error rather than falling back to the beginning. (low confidence) [source]
- The Save method on CheckpointStore stores the supplied checkpoint string through ReplaceOne with upsert; it performs no ObjectID parse, monotonicity comparison, or conditional update against a previous checkpoint. The round-trip fixture separately saves and loads seq-100 and then overwrites it with seq-200. These fixture values exercise string persistence rather than Fetch-compatible ObjectID validation. (medium confidence) [source 1] [source 2]
Facts and statements
- Inference from the predicates: if timestamp order and ObjectID order disagree, advancing the checkpoint to the returned SequenceID can exclude a still-pending document with a smaller or equal _id, even if that document sorts later by timestamp. The ordering fixture spaces sequential appends with time.Sleep(time.Millisecond) and advances the checkpoint; it does not establish arbitrary concurrent-producer ordering. (medium confidence) [source 1] [source 2]
- Fetch accepts pending documents or inflight documents whose inflight_at is strictly less than now minus the visibility timeout, then atomically claims one with FindOneAndUpdate by setting status to inflight and inflight_at to now. Reclaiming this way does not increment retry_count; the returned RetryCount comes from the stored document. (low confidence) [source]
- Inference from Fetch: expiration of visibility does not override checkpoint filtering. A stale inflight document at or below the supplied ObjectID checkpoint remains excluded. Nack returning that document to pending also does not remove the _id $gt requirement on a subsequent Fetch using that checkpoint. (low confidence) [source]
- Ack and Nack match only _id and event_name, without a consumer, claim token, inflight_at, or current-status condition. Ack sets status to acked and acked_at to time.Now(); Nack sets status to pending, increments retry_count, and unsets inflight_at. Inference: these methods do not fence a delayed caller after a visibility-timeout reclaim, and Nack can match an already acked document. (low confidence) [source]
- The reviewed methods provide a message claim/update and a separate checkpoint replacement. Save does not call Ack or an application effect, and Ack does not call Save. Inference: these bodies alone establish no atomic checkpoint-plus-effect protocol. MongoDB documents distinguish single-document atomic operations from transactions spanning multiple documents; this does not rule out a caller supplying transaction context. (medium confidence) [source 1] [source 2] [source 3]
- The FetchOrderingAndCheckpoint fixture appends m0 through m3 sequentially, sleeps time.Millisecond after each append to keep timestamps strictly increasing, uses WithVisibilityTimeout(time.Hour), and advances its local checkpoint to each fetched SequenceID. It checks payload and sequence order and an empty result past the end. This fixture does not construct divergent timestamp/ObjectID order or concurrent producers; reading it is not an execution result. (low confidence) [source]
- The Nack fixture fetches with an empty checkpoint, checks that an immediate second Fetch returns nothing, calls Nack, and again fetches with an empty checkpoint while expecting RetryCount to move from 0 to 1. The visibility fixture configures 300 * time.Millisecond, checks immediate invisibility, sleeps visibility + 250*time.Millisecond, and reclaims using an empty checkpoint. These fixtures do not exercise reclamation behind an advanced checkpoint or delayed Ack/Nack after reclaim. (low confidence) [source]
- The checkpoint round-trip fixture checks missing Load returning an empty string, Save/Load, overwrite, Delete/Load, and deleting a missing key. Its body does not call Fetch or Ack on Store or mutate an application projection. The ordering fixture advances a local string without calling Save on CheckpointStore. These separate source fixtures do not establish atomic checkpoint-plus-effect behavior. (low confidence) [source]
Children
- No children recorded.