Skip to content

Add box.info.ro_reason description #3170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions doc/reference/reference_lua/box_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ variables.
* **pid** is the process ID. This value is also shown by
:ref:`tarantool <tarantool-build>` module
and by the Linux command ``ps -A``.
* **ro** is ``true`` if the instance is in "read-only" mode
* **ro** is ``true`` if the instance is in read-only mode
(same as :ref:`read_only <cfg_basic-read_only>` in ``box.cfg{}``),
or if status is 'orphan'.
* **ro_reason** is ``nil`` if the instance is in writable mode.
When the field is not ``nil``, it contains the reason why the instance is read-only.
Possible error reasons: ``election``, ``synchro``, ``config``, and ``orphan``
(see :ref:`box.info.ro_reason <box_info_ro-reason>` for details).
* **signature** is the sum of all ``lsn`` values from each :ref:`vector clock <replication-vector>`
(**vclock**) for all instances in the replica set.
* **sql().cache.size** is the number of bytes in the SQL prepared statement cache.
Expand All @@ -56,7 +60,7 @@ variables.
* **election** shows the current state of a replica set node regarding leader
election (see :doc:`here </reference/reference_lua/box_info/election>`).

Below is a list of all ``box.info`` functions.
Below is a list of all ``box.info`` functions and members.

.. container:: table

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

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

.. toctree::
:hidden:
Expand All @@ -107,3 +113,4 @@ Below is a list of all ``box.info`` functions.
box_info/listen
box_info/election
box_info/synchro
box_info/ro_reason
40 changes: 40 additions & 0 deletions doc/reference/reference_lua/box_info/ro_reason.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.. _box_info_ro-reason:

================================================================================
box.info.ro_reason
================================================================================

.. module:: box.info

.. data:: ro_reason

Since :doc:`2.10.0 </release/2.10.0>`.
Show the current mode of an instance (writable or read-only).
Contains ``nil`` if the instance is in writable mode.
When the field is not ``nil``, reports the reason why the instance is read-only.

Possible error reasons:

* ``election`` -- the instance is not the leader.
That is, ``box.cfg.election_mode`` is not ``off``.
See :ref:`box.info.election <box_info_election>` for details.

* ``synchro`` -- the instance is not the owner of the synchronous transaction queue.
For details, see :ref:`box.info.synchro <box_info_synchro>`.

* ``config`` -- the server instance is in read-only mode.
That is, :ref:`box.cfg.read_only <cfg_basic-read_only>` is ``true``.

* ``orphan`` -- the instance is in ``orphan`` state.
For details, see :ref:`the orphan status page <internals-replication-orphan_status>`.

:rtype: string

**Example:**

.. code-block:: tarantoolsession

tarantool> box.info.ro_reason
---
- null
...