Skip to content

Snapshot Isolation: ColumnShard #12972

@nikvas0

Description

@nikvas0

Description (image of the result)

Customers can use Snapshot Isolated transactions for Column Tables.
The following use cases are ready for using:

  1. Data marts
  • tx1 reads a lot from table1, calculates a lot, and writes a bit to a table2
  • tx2 concurrently writes a lot to table1 intersecting with what tx1 reads
  1. Copy table using sql operators
  • tx1 reads all the table1, and writes all of the data to table2
  • tx2 concurrently writes to table1

DoD

The changes are merged into stable-???-??? and available in cloud.

Changelog entry

Snapshot isolated transactions are available in Column Tables.

Documentation

https://ydb.tech/docs/ru/concepts/transactions?version=main#modes

#29587

Dependencies

Compatibility

Rolling update no-snapshot-isolation-version -> snapshot-isolation-version. No problems expected. Snapshot isolated transaction on no-snapshot-isolation-version will behave as serializable (default). So, no data loses or unexpected anomalies.

Rolling update snapshot-isolation-version -> no-snapshot-isolation-version. No problems expected. See explanation above.

Compatibility тесты не требуются

Test plan

Stress tests

Implementation Plan

Milestone 1. the relaxed version is supported - no read conflicts
Deadline 24.11.2025 ✅ in stable-25-3

Milestone 2. the classic version - no read conflicts, yes write conflicts
Deadline 01.12.2025 ✅ in stable-25-3

Milestone 3. the classic sped up version, do not read data for writes, only detects conflicts
Deadline 08.12.2025 ✅ in stable-25-3

Milestone 4 jepsen passes
Deadline ??? - depends on #28452

Milestone 5 support long transactions
Deadline ??? - depends on the previous milestone

Feature flag

table_service_config. EnableSnapshotIsolationRW

Promotion

Promotion makes sense because the lack of snapshot isolation was a deal breaker for some potential customers.

  • explicitly notify the customers that need it
    • ???
  • post on Atushka

Implementation details

Snapshot Isolation transactions use LockMode = OPTIMISTIC_SNAPSHOT_ISOLATION (https://github.com/ydb-platform/ydb/blame/257ac8b881d2e2485934f6b5347c9d57958232f5/ydb/core/protos/data_events.proto#L69) in EvWrite/EvRead/DataTransaction/Scan.

Writes:

  • Locks are taken from the MVCCSnapshot timestamp (not the current timestamp like for serializable isolation).

Reads:

  • No locks are taken for reads. LockId still exists here to support uncommitted changes read.

These tests will pass after implementing Snapshot Isolation for shards.

ydb/core/kqp/ut/tx KqpSnapshotIsolation.TConflictWrite*

Sub-issues

Metadata

Metadata

Labels

area/cs/tx-lockscomplete/noneДля тикетов: еще не готово ни в какой ветке (но есть ожидания)release/plan/25-4Для тикетов: тикет участвует в Релизной Таблице (тм) релиза 25-4

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions