@@ -46,7 +46,11 @@ box.info.synchro
46
46
Since version :doc: `2.5.3 </release/2.5.3 >`, the option can be set as a dynamic formula.
47
47
In this case, the value in the ``quorum `` member depends on the current number of replicas.
48
48
49
- **Examples: **
49
+ **Example 1: **
50
+
51
+ In this example, the ``quorum `` field is equal to ``1 ``.
52
+ This means that the synchronous transactions work like asynchronous.
53
+ `1 ` means that successful WAL write to the master is enough to commit.
50
54
51
55
.. code-block :: tarantoolsession
52
56
@@ -60,28 +64,51 @@ box.info.synchro
60
64
quorum: 1
61
65
...
62
66
67
+ **Example 2: **
68
+
69
+ //the description goes here
70
+
71
+
63
72
.. code-block :: tarantoolsession
64
73
74
+ -- Set quorum number and timeout
65
75
tarantool> box.cfg{replication_synchro_quorum=2, replication_synchro_timeout=1000}
66
76
---
67
77
...
68
- tarantool> s = box.schema.space.create("sync", {is_sync=true})
78
+
79
+ -- Check info about synchronous replication
80
+ tarantool> box.info.synchro
69
81
---
82
+ - queue:
83
+ owner: 0
84
+ term: 0
85
+ len: 0
86
+ busy: false
87
+ quorum: 2
70
88
...
89
+
90
+ -- Create a space and enable synchronous replication on this space
91
+ -- Create index
92
+ tarantool> s = box.schema.space.create("sync", {is_sync=true})
71
93
tarantool> _ = s:create_index('pk')
72
94
---
73
95
...
96
+
97
+ -- Claim the queue with the promote function
74
98
tarantool> box.ctl.promote()
75
99
2022-09-15 14:27:11.734 [74314] main/103/interactive I> RAFT: bump term to 2, follow
76
100
2022-09-15 14:27:11.734 [74314] main/118/raft_worker I> RAFT: persisted state {term: 2}
77
101
---
78
102
...
103
+
79
104
tarantool> require('fiber').new(function() box.space.sync:replace{1} end)
80
105
---
81
106
- status: suspended
82
107
name: lua
83
108
id: 119
84
109
...
110
+
111
+ -- Check the current state of synchronous replication.
85
112
tarantool> box.info.synchro
86
113
---
87
114
- queue:
@@ -109,6 +136,9 @@ box.info.synchro
109
136
name: lua
110
137
id: 122
111
138
...
139
+
140
+ -- Check the current state of synchronous replication.
141
+ -- Now there are 4 transactions waiting in the queue.
112
142
tarantool> box.info.synchro
113
143
---
114
144
- queue:
0 commit comments