Skip to content

Commit 8d5d58a

Browse files
authored
Add box.info.ro_reason description (#3170)
Fixes #2445
1 parent 45e1300 commit 8d5d58a

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

doc/reference/reference_lua/box_info.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ variables.
2828
* **pid** is the process ID. This value is also shown by
2929
:ref:`tarantool <tarantool-build>` module
3030
and by the Linux command ``ps -A``.
31-
* **ro** is ``true`` if the instance is in "read-only" mode
31+
* **ro** is ``true`` if the instance is in read-only mode
3232
(same as :ref:`read_only <cfg_basic-read_only>` in ``box.cfg{}``),
3333
or if status is 'orphan'.
34+
* **ro_reason** is ``nil`` if the instance is in writable mode.
35+
When the field is not ``nil``, it contains the reason why the instance is read-only.
36+
Possible error reasons: ``election``, ``synchro``, ``config``, and ``orphan``
37+
(see :ref:`box.info.ro_reason <box_info_ro-reason>` for details).
3438
* **signature** is the sum of all ``lsn`` values from each :ref:`vector clock <replication-vector>`
3539
(**vclock**) for all instances in the replica set.
3640
* **sql().cache.size** is the number of bytes in the SQL prepared statement cache.
@@ -56,7 +60,7 @@ variables.
5660
* **election** shows the current state of a replica set node regarding leader
5761
election (see :doc:`here </reference/reference_lua/box_info/election>`).
5862

59-
Below is a list of all ``box.info`` functions.
63+
Below is a list of all ``box.info`` functions and members.
6064

6165
.. container:: table
6266

@@ -95,6 +99,8 @@ Below is a list of all ``box.info`` functions.
9599
* - :doc:`./box_info/synchro`
96100
- Show the current state of synchronous replication
97101

102+
* - :doc:`./box_info/ro_reason`
103+
- Show the current mode of an instance (writable or read-only)
98104

99105
.. toctree::
100106
:hidden:
@@ -107,3 +113,4 @@ Below is a list of all ``box.info`` functions.
107113
box_info/listen
108114
box_info/election
109115
box_info/synchro
116+
box_info/ro_reason
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _box_info_ro-reason:
2+
3+
================================================================================
4+
box.info.ro_reason
5+
================================================================================
6+
7+
.. module:: box.info
8+
9+
.. data:: ro_reason
10+
11+
Since :doc:`2.10.0 </release/2.10.0>`.
12+
Show the current mode of an instance (writable or read-only).
13+
Contains ``nil`` if the instance is in writable mode.
14+
When the field is not ``nil``, reports the reason why the instance is read-only.
15+
16+
Possible error reasons:
17+
18+
* ``election`` -- the instance is not the leader.
19+
That is, ``box.cfg.election_mode`` is not ``off``.
20+
See :ref:`box.info.election <box_info_election>` for details.
21+
22+
* ``synchro`` -- the instance is not the owner of the synchronous transaction queue.
23+
For details, see :ref:`box.info.synchro <box_info_synchro>`.
24+
25+
* ``config`` -- the server instance is in read-only mode.
26+
That is, :ref:`box.cfg.read_only <cfg_basic-read_only>` is ``true``.
27+
28+
* ``orphan`` -- the instance is in ``orphan`` state.
29+
For details, see :ref:`the orphan status page <internals-replication-orphan_status>`.
30+
31+
:rtype: string
32+
33+
**Example:**
34+
35+
.. code-block:: tarantoolsession
36+
37+
tarantool> box.info.ro_reason
38+
---
39+
- null
40+
...

0 commit comments

Comments
 (0)