Skip to content

Commit 9597a72

Browse files
authored
Clarify anonymous replica behavior in quorum since 2.10.0 (#3105)
Resolves #2600 * Format by style guide * Clarify the behavior of anonymous replicas in quorum since 2.10.0 * Correct conf parameter description
1 parent d0edf8a commit 9597a72

File tree

3 files changed

+30
-40
lines changed

3 files changed

+30
-40
lines changed

doc/book/replication/repl_sync.rst

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
.. _repl_sync:
22

3-
================================================================================
43
Synchronous replication
5-
================================================================================
4+
=======================
65

7-
--------------------------------------------------------------------------------
86
Overview
9-
--------------------------------------------------------------------------------
7+
--------
108

119
By default, replication in Tarantool is **asynchronous**: if a transaction
1210
is committed locally on a master node, it does not mean it is replicated onto any
@@ -17,14 +15,13 @@ to a replica, from the client's point of view the transaction will disappear.
1715
are not considered committed and are not responded to a client until they are
1816
replicated onto some number of replicas.
1917

20-
--------------------------------------------------------------------------------
2118
Usage
22-
--------------------------------------------------------------------------------
19+
-----
2320

2421
Since version :doc:`2.5.1 </release/2.5.1>`,
2522
synchronous replication can be enabled per-space by using the ``is_sync`` option:
2623

27-
.. code-block:: lua
24+
.. code-block:: lua
2825
2926
box.schema.create_space('test1', {is_sync = true})
3027
@@ -34,15 +31,15 @@ Notice that DDL on this space (including truncation) is **not** synchronous.
3431
To control the behavior of synchronous transactions, there exist global
3532
``box.cfg`` :ref:`options <cfg_replication-replication_synchro_quorum>`:
3633

37-
.. code-block:: lua
34+
.. code-block:: lua
3835
3936
box.cfg{replication_synchro_quorum = <number of instances>}
4037
4138
This option tells how many replicas should confirm the receipt of a synchronous
42-
transaction before it is committed. So far, this option accounts for all
43-
replicas including anonymous ones. As a usage example, consider this:
39+
transaction before it is committed. Since version :doc:`2.10.0 </release/2.10.0>`,
40+
this option does not account for anonymous replicas. As a usage example, consider this:
4441

45-
.. code-block:: lua
42+
.. code-block:: lua
4643
4744
-- Instance 1
4845
box.cfg{
@@ -53,15 +50,15 @@ replicas including anonymous ones. As a usage example, consider this:
5350
_ = box.schema.space.create('sync', {is_sync=true})
5451
_ = _:create_index('pk')
5552
56-
.. code-block:: lua
53+
.. code-block:: lua
5754
5855
-- Instance 2
5956
box.cfg{
6057
listen = 3314,
6158
replication = 'localhost:3313'
6259
}
6360
64-
.. code-block:: lua
61+
.. code-block:: lua
6562
6663
-- Instance 1
6764
box.space.sync:replace{1}
@@ -74,12 +71,12 @@ replica. This is because the master instance itself also participates in the quo
7471
Now, if the second instance is down, the first one won't be able to commit any
7572
synchronous change.
7673

77-
.. code-block:: lua
74+
.. code-block:: lua
7875
7976
-- Instance 2
8077
Ctrl+D
8178
82-
.. code-block:: tarantoolsession
79+
.. code-block:: tarantoolsession
8380
8481
-- Instance 1
8582
tarantool> box.space.sync:replace{2}
@@ -90,7 +87,7 @@ synchronous change.
9087
The transaction wasn't committed because it failed to achieve the quorum in the
9188
given time. The time is a second configuration option:
9289

93-
.. code-block:: lua
90+
.. code-block:: lua
9491
9592
box.cfg{replication_synchro_timeout = <number of seconds, can be float>}
9693
@@ -104,9 +101,8 @@ The ``timeout`` and ``quorum`` options are not used on replicas. It means if
104101
the master dies, the pending synchronous transactions will be kept waiting on
105102
the replicas until a new master is elected.
106103

107-
--------------------------------------------------------------------------------
108104
Synchronous and asynchronous transactions
109-
--------------------------------------------------------------------------------
105+
-----------------------------------------
110106

111107
A killer feature of Tarantool's synchronous replication is its being *per-space*.
112108
So, if you need it only rarely for some critical data changes, you won't pay for
@@ -134,9 +130,8 @@ This just means it will wait for the synchronous transaction to be committed.
134130
But once it is done, the asynchronous transaction will be committed
135131
immediately—it won't wait for being replicated itself.
136132

137-
--------------------------------------------------------------------------------
138133
Limitations and known problems
139-
--------------------------------------------------------------------------------
134+
------------------------------
140135

141136
Until version :doc:`2.5.2 </release/2.5.2>`,
142137
there was no way to enable synchronous replication for
@@ -146,22 +141,18 @@ existing spaces, but since 2.5.2 it can be enabled by
146141
Synchronous transactions work only for master-slave topology. You can have multiple
147142
replicas, anonymous replicas, but only one node can make synchronous transactions.
148143

149-
Anonymous replicas participate in the quorum.
150-
However, this will change: it won't be possible
151-
for a synchronous transaction to gather quorum using anonymous replicas in the future.
144+
Since Tarantool :doc:`2.10.0 </release/2.10.0>`, anonymous replicas do not participate in the quorum.
152145

153-
--------------------------------------------------------------------------------
154146
Leader election
155-
--------------------------------------------------------------------------------
147+
---------------
156148

157149
Starting from version :doc:`2.6.1 </release/2.6.1>`,
158150
Tarantool has the built-in functionality
159151
managing automated leader election in a replica set. For more information,
160152
refer to the :ref:`corresponding chapter <repl_leader_elect>`.
161153

162-
--------------------------------------------------------------------------------
163154
Tips and tricks
164-
--------------------------------------------------------------------------------
155+
---------------
165156

166157
If a transaction is rolled back, it does not mean the ROLLBACK message reached
167158
the replicas. It still can happen that the master node suddenly dies, so the

doc/reference/configuration/cfg_replication.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,10 @@
426426
Since version :doc:`2.5.1 </release/2.5.1>`.
427427
For :ref:`synchronous replication <repl_sync>` only.
428428
This option tells how many replicas should confirm the receipt of a
429-
synchronous transaction before it can finish its commit. So far this
430-
option accounts all replicas, including anonymous.
429+
synchronous transaction before it can finish its commit.
430+
431+
Since version :doc:`2.10.0 </release/2.10.0>`, this option
432+
does not account for anonymous replicas.
431433

432434
It is 1 by default, so synchronous transactions work like asynchronous when
433435
not configured. 1 means successful WAL write on master is enough for

locale/ru/LC_MESSAGES/book/replication/repl_sync.po

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ msgstr "box.cfg{replication_synchro_quorum = <количество экземп
6161

6262
msgid ""
6363
"This option tells how many replicas should confirm the receipt of a "
64-
"synchronous transaction before it is committed. So far, this option accounts"
65-
" for all replicas including anonymous ones. As a usage example, consider "
64+
"synchronous transaction before it is committed. Since version :doc:`2.10.0 </release/2.10.0>`, "
65+
"this option does not account for anonymous replicas. As a usage example, consider "
6666
"this:"
6767
msgstr ""
68-
"Параметр указывает, сколько реплик должно подтвердить получение синхронной "
69-
"транзакции, прежде чем она пройдет коммит. Учитываются все реплики, включая "
70-
"анонимные. Пример:"
68+
"Параметр указывает, сколько реплик должно подтвердить получение синхронной "
69+
"транзакции, прежде чем она пройдет коммит. Начиная с версии :doc:`2.10.0 </release/2.10.0>`, "
70+
"анонимные реплики не учитываются. Пример:"
7171

7272
msgid ""
7373
"-- Instance 1\n"
@@ -268,13 +268,10 @@ msgstr ""
268268
"синхронные транзакции должен совершать только один узел."
269269

270270
msgid ""
271-
"Anonymous replicas participate in the quorum. However, this will change: it "
272-
"won't be possible for a synchronous transaction to gather quorum using "
273-
"anonymous replicas in the future."
271+
"Since Tarantool :doc:`2.10.0 </release/2.10.0>`, anonymous replicas "
272+
"do not participate in the quorum."
274273
msgstr ""
275-
"Анонимные реплики принимают участие в кворуме. Однако в будущих версиях это "
276-
"изменится: для синхронной транзакции кворум с участием анонимных реплик "
277-
"собрать будет нельзя."
274+
"Начиная с версии Tarantool :doc:`2.10.0 </release/2.10.0>`, анонимные реплики не участвуют в кворуме."
278275

279276
msgid "Leader election"
280277
msgstr "Выборы лидера"

0 commit comments

Comments
 (0)