Skip to content
Snippets Groups Projects
Commit 0b1f9b0f authored by Aleksandr Lyapunov's avatar Aleksandr Lyapunov Committed by Aleksandr Lyapunov
Browse files

txm: add changelog and doc request

@TarantoolBot document
Title: Document transaction isolation settings

All transactions in tarantool see only committed changes, but is
a loose concept since the commit of a transaction is long-term
act and there's a dilemma of choosing a timepoint at which the
changes must be seen by other transactions.

When enabled, mvcc engine allows some options on this field.
To be  specific we introduced two levels of isolaton:
* read-committed: all transaction that have started committing
(box.commit() was called) are visible.
* read-confirmed: all transaction that have finished committing
(box.commit() returnd) are visible.

The first level is good for RW transactions since it allows to
avoid some conflicts, while the second is good for RO transactions
since it allows to get tuples that a definitely was perisisten on
disk.

There's also a default option that allows mvcc engine to decide:
* best-effort: do the best depending of which actions the
transaction has made.

For autocommit transaction (one-statement actions without explicit
box.begin/commit calls) an obvious rule is apllied: RO (select,
get, count etc) transactions are done with read-confirmed; all
other (replace, delete, etc) - read-committed.

If a transaction has an explicit box.begin call, the level can be
specified in the following way:
box.begin({tnx_isolation = 'default'})
box.begin({txn_isolation = 'read-committed'})
box.begin({txn_isolation = 'read-confirmed'})
box.begin({tnx_isolation = 'best-effort'})

One can similarly set the level in net.box stream begin() method.

If not specified (or if 'default' was passed) the level is taken
from configuration. One can set default level in box.cfg:
box.cfg({default_txn_isolation = 'read-committed'})
box.cfg({default_txn_isolation = 'read-confirmed'})
box.cfg({default_tnx_isolation = 'best-effort'})

The default option is 'best-effort'.

In iproto the level is specified by IPROTO_TNX_ISOLATION key in
the body of IPROTO_BEGIN request. The value is the one of the
following enum values:
enum txn_isolation_level {
	/** Take isolation level from global default level. */
	TXN_ISOLATION_DEFAULT = 0,
	/** Allow to read committed, but not confirmed changes. */
	TXN_ISOLATION_READ_COMMITTED = 1,
	/** Allow to read only confirmed changes. */
	TXN_ISOLATION_READ_CONFIRMED = 2,
	/** Determine isolation level automatically. */
	TXN_ISOLATION_BEST_EFFORD = 3,
};

NO_TEST=no changes
Closes #6930
parent a8eda574
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment