Skip to content

Enable snapshot read concern for single-node documentdb-local deployments #736

Open

Description

@xgerman

Describe the bug

documentdb-local rejects transactions using readConcern: { level: "snapshot" } even though its PostgreSQL deployment can provide a stable transaction snapshot through REPEATABLE READ.

The gateway already contains the required mapping:

  • ReadConcern::Snapshot selects IsolationLevel::RepeatableRead in documentdb_gateway_core/src/requests/common_fields.rs.
  • Transaction validation permits it only when allow_transaction_snapshot() is enabled in documentdb_gateway_core/src/requests/validation.rs.
  • The configuration defaults to false, so documentdb-local returns CommandNotSupported instead of using the existing implementation.

Environment

  • documentdb-local
  • Architecture independent

Reproduction Steps

Run a read in a transaction configured with snapshot read concern:

const session = client.startSession();

try {
  session.startTransaction({
    readConcern: { level: "snapshot" }
  });

  await collection.findOne({}, { session });
  await session.abortTransaction();
} finally {
  await session.endSession();
}

Expected behavior

The transaction starts successfully and all reads in the transaction use the same PostgreSQL MVCC snapshot through REPEATABLE READ.

For documentdb-local snapshot read concern should be enabled by default.

Actual behavior

The first operation in the transaction fails with error code 115, CommandNotSupported:

'Snapshot' read concern is not supported

Acceptance criteria

  • Snapshot read concern is accepted by default in documentdb-local.
  • Snapshot transactions use PostgreSQL REPEATABLE READ.
  • A concurrency test verifies that two reads in one transaction observe the same snapshot while another connection commits a change between them.
  • Existing validation remains available for deployment modes that cannot guarantee a transaction-wide snapshot.
  • Unsupported timestamp-selection fields, such as atClusterTime, are either explicitly rejected or documented separately rather than silently implying point-in-time support.

Additional context

This report was prepared with GitHub Copilot assistance and reviewed by the author before submission.

Activity

  1. added
    gateway
    documentdb-local
    on Sep 3, 2026
  2. documentdb-triage-tool commented on Sep 18, 2026

    @documentdb-triage-tool

    👋 @guanzhousongmicrosoft — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  3. documentdb-triage-tool commented on Oct 2, 2026

    @documentdb-triage-tool

    👋 @guanzhousongmicrosoft — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  4. added this to the 1.0 milestone on Oct 5, 2026
  5. guanzhousongmicrosoft commented on Oct 5, 2026

    @guanzhousongmicrosoft
    Member

    The fix is the gateway default for mongoAllowTransactionSnapshot (currently false), or making that default depend on the deployment mode. The container itself has nothing to change. Targeting 1.0; this needs a gateway change.

  6. documentdb-triage-tool commented on Oct 28, 2026

    @documentdb-triage-tool

    👋 @guanzhousongmicrosoft — this issue has been assigned for 23 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  7. self-assigned this
    on Nov 3, 2026
  8. documentdb-triage-tool commented on Nov 17, 2026

    @documentdb-triage-tool

    👋 @tsharp, @guanzhousongmicrosoft — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

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

Metadata

Metadata

Labels

bugdocumentdb-1.0documentdb-localgateway

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions