Distributed transactions

How a transaction that touches several ranges and nodes commits.

A TeselaDB transaction can touch documents on several ranges and nodes and commits atomically.

How it works

1 range:   writes ──▶ a single Write by the leader (one phase)

several:   intents on each range ──▶ transaction record: committed
                                          │
                                          ▼
                           intent resolution in the background

If every key of the transaction falls in one range, the leader commits it with a single write. If not, each range keeps provisional versions (intents) and a transaction record, kept in the range that covers its key, decides whether it commits or aborts. A reader that finds a pending intent pushes the transaction or waits for it to be resolved. Turning the intents into versions goes on in the background after answering.

What it means for your application

Transactions have MongoDB's semantics: the drivers' withTransaction retries what it must. A conflict with another write gives WriteConflict with the TransientTransactionError label.

Limits

A transaction aborts after 60 seconds by default. Its state must fit in its coordinator's memory. A collector aborts abandoned records.

Learn more