Skip to content

Commit d03f3b2

Browse files
authored
fixes gh-399 add notes about transactions (#1176)
1 parent e7a8fc8 commit d03f3b2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

doc/book/box/atomic.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ query:
2121
2222
tarantool> box.space.tester:update({3}, {{'=', 2, 'size'}, {'=', 3, 0}})
2323
24-
This is equivalent to the following SQL statement for a table that stores
24+
This is equivalent to the following SQL statement for a table that stores
2525
primary keys in ``field[1]``:
2626

2727
.. code-block:: SQL
@@ -127,6 +127,12 @@ The cooperative scheduler ensures that, in absence of yields,
127127
a multi-statement transaction is not preempted and hence is never aborted.
128128
Therefore, understanding yields is essential to writing abort-free code.
129129

130+
Sometimes while testing the transaction mechanism in Tarantool you can notice
131+
that yielding after ``box.begin()`` but before any read/write operation does not
132+
cause an abort as it should according to the description. This happens because
133+
actually ``box.begin()`` does not start a transaction. It is a mark telling
134+
Tarantool to start a transaction after some database request that follows.
135+
130136
.. note::
131137

132138
You can’t mix storage engines in a transaction today.
@@ -158,6 +164,10 @@ Many functions in modules :ref:`fio <fio-section>`, :ref:`net_box <net_box-modul
158164
:ref:`console <console-module>` and :ref:`socket <socket-module>`
159165
(the "os" and "network" requests) yield.
160166

167+
That is why executing separate commands such as ``select()``, ``insert()``,
168+
``update()`` in the console inside a transaction will cause an abort. This is
169+
due to implicit yield happening after each chunk of code is executed in the console.
170+
161171
**Example #1**
162172

163173
* *Engine = memtx* |br|

0 commit comments

Comments
 (0)