Skip to content

MongoDB seal: non-transactional withdrawal window and conditional-append heads without a generation #49

Closed

Description

@senamakel

Follow-ups found while landing the uniform v2 schema (#48). Neither loses data. Both are MongoDB-only.

  1. A withdrawn seal marker can be seen briefly without transactions. On a deployment without multi-document transactions, a seal that loses a race with truncate_before inserts its marker, re-checks the head's truncate_epoch, and withdraws the marker with Conflict.
    • In that window (milliseconds), a reader can see the sealed view.
    • Two sealers racing one truncation in the window could leave entries dropped from a stream that never got sealed.
    • A rollback-free design would clip sealed reads at a durable truncation floor kept on the stream head.
  2. Conditional-append heads lack g. append_once's head upsert, for conditional appends, creates a stream head with no g (generation) field. delete_sealed_in filters on g: 0, so it misses such heads. Retention then reports a conflict and skips the stream instead of deleting it. Fix: write $max: {g: 0} on that upsert (as the new head writes already do), or match on a missing g too.

Activity

  1. tinysweeper commented on Oct 16, 2026

    @tinysweeper

    Two MongoDB-only follow-ups from the v2 schema work: (1) without multi-document transactions, a withdrawn seal marker is briefly visible and two sealers racing a truncation can leave unsealed streams missing entries; (2) append_once's conditional-append head upsert omits the g generation field, so delete_sealed_in (which filters g: 0) misses those heads and retention skips the stream. No data loss in either case; fix (2) by writing $max: {g: 0} or matching a missing g.

    Labelled priority: p2.

  2. added theissue type on Oct 16, 2026
  3. senamakel commented on Oct 16, 2026

    @senamakel
    MemberAuthor

    Two more review findings that arrived after #48's review rounds closed (threads left open on #48):

    • P1, schema/runner.rs:359: reject in-place renames onto another source record. In an in-place batch, an old-schema record whose new id equals another, not-yet-migrated source record's id can overwrite it. Uniform v2 record schema (v1.0.0) #48 (comment)
    • P2, sqlite/src/sql/upgrade.rs:336: reject impossible RFC 3339 calendar dates (for example 2026-02-31) in the v0 backfill instead of producing a shifted instant.
  4. senamakel commented on Oct 16, 2026

    @senamakel
    MemberAuthor

    Gap found in epic work (senamakel/tinyjuice#1): Step::blobs re-puts each target without an expiry, and BlobOutput cannot carry one. Blobs with a TTL (for example tinyjuice CCR originals) lose it when migrated. BlobOutput should be able to carry or preserve expires_at.

  5. senamakel commented on Oct 16, 2026

    @senamakel
    MemberAuthor

    Two more gaps found in epic work (senamakel/tinymcp#1):

    • Registry steps have no kind for secrets, so secret names (for example mcp_client_env/*) can't be renamed to v2 <owner>/… prefixes.
    • WriteOp::Put in atomic_batch takes no WriteOptions, so batched writes record schema = 0.
  6. M3gA-Mind commented on Nov 11, 2026

    @M3gA-Mind
    Collaborator

    Re-checked against main after the v2 rollup (#83). (b) is fixed ($max {g:0}), and (c)-(f) are obsolete: the runner, upgrade.rs, BlobOutput and registry are all gone.
    Two items remain: (a) the non-transactional seal withdrawal window (mongodb/streams.rs:1109-1133), and (g) WriteOp::Put in atomic batches takes no WriteOptions (types/document/types.rs:366-378), so batched writes record schema 0. Also: batch puts drop expires_ms too, and the facade's Mongo streams have no blob store, so seal is Unsupported. Suggest narrowing this issue to (a) + (g), and filing the seal/blob-store wiring separately.

  7. M3gA-Mind commented on Nov 11, 2026

    @M3gA-Mind
    Collaborator

    Done in three merged PRs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions