Skip to content

Commit 7814e54

Browse files
authored
Adds hierarchy table description (#5150)
* Adds hierarchy table description * Since 3.3.0 the ``hierarchy`` table shows names of the group, replicaset, and the instance itself * Table is reported in ``config:info()``; ``config:info('v2')``; ``box.info.config`` * Fixes #4608
1 parent 00a19a3 commit 7814e54

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

doc/reference/reference_lua/box_info/config.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ box.info.config
1313
The instance's state in regard to configuration.
1414
Note that ``box.info.config`` returns the instance's state obtained using :ref:`config:info('v2') <config_api_reference_info>`.
1515

16+
Since version :doc:`3.3.0 </release/3.3.0>` returns the ``hierarchy`` table, showing names of the group, replicaset, and the instance itself.
17+
These names are taken directly from the ``--name`` CLI option (or the ``TT_INSTANCE_NAME`` environment variable)
18+
and the cluster configuration. This means they are always present if the YAML configuration flow is in use,
19+
disregarding the database status (whether upgraded, writable or not).
20+
1621
:rtype: table
1722

1823
**Example**
@@ -26,4 +31,8 @@ box.info.config
2631
last: &0 []
2732
active: *0
2833
alerts: []
34+
hierarchy:
35+
group: storages
36+
replicaset: storage-a
37+
instance: storage-a-002
2938
...

doc/reference/reference_lua/box_info/info.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ box.info()
1717
:return: keys and values in the submodule
1818
:rtype: table
1919

20+
Since version :doc:`3.3.0 </release/3.3.0>` returns the ``hierarchy`` table, showing names of the group, replicaset, and the instance itself.
21+
These names are taken directly from the ``--name`` CLI option (or the ``TT_INSTANCE_NAME`` environment variable)
22+
and the cluster configuration. This means they are always present if the YAML configuration flow is in use,
23+
disregarding the database status (whether upgraded, writable or not).
24+
2025
**Example**
2126

2227
This example is for a master-replica set that contains one master instance
@@ -94,4 +99,8 @@ box.info()
9499
last: &0 []
95100
active: *0
96101
alerts: []
102+
hierarchy:
103+
group: storages
104+
replicaset: storage-a
105+
instance: storage-a-002
97106
...

doc/reference/reference_lua/config.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ config API
159159

160160
- ``alerts`` -- warnings or errors raised on an attempt to apply the configuration
161161

162+
Since version :doc:`3.3.0 </release/3.3.0>`
163+
164+
- ``hierarchy`` -- table, showing names of the group, replicaset, and the instance itself.
165+
These names are taken directly from the ``--name`` CLI option (or the ``TT_INSTANCE_NAME`` environment variable)
166+
and the cluster configuration. This means they are always present if the YAML configuration flow is in use,
167+
disregarding the database status (whether upgraded, writable or not).
168+
162169
Below are a few examples demonstrating how the ``info()`` output might look.
163170

164171
**Example: no configuration warnings or errors**
@@ -174,6 +181,10 @@ config API
174181
last: &0 []
175182
active: *0
176183
alerts: []
184+
hierarchy:
185+
group: group-001
186+
replicaset: replicaset-001
187+
instance: instance-001
177188
...
178189
179190
**Example: configuration warnings**
@@ -196,6 +207,10 @@ config API
196207
upgrade has not been performed, or the privilege write has failed (separate
197208
alert reported)
198209
timestamp: 2024-07-03T18:09:18.826138+0300
210+
hierarchy:
211+
group: group-001
212+
replicaset: replicaset-001
213+
instance: instance-001
199214
...
200215
201216
This warning is cleared when the ``bands`` space is created.
@@ -219,6 +234,10 @@ config API
219234
allowed: 0, fatal, 1, syserror, 2, error, 3, crit, 4, warn, 5, info, 6, verbose,
220235
7, debug'
221236
timestamp: 2024-07-03T18:13:19.755454+0300
237+
hierarchy:
238+
group: group-001
239+
replicaset: replicaset-001
240+
instance: instance-001
222241
...
223242
224243
**Example: configuration errors (centralized configuration storage)**
@@ -248,6 +267,10 @@ config API
248267
8, but only the following values are allowed: 0, fatal, 1, syserror, 2, error,
249268
3, crit, 4, warn, 5, info, 6, verbose, 7, debug'
250269
timestamp: 2024-07-03T15:22:06.438275Z
270+
hierarchy:
271+
group: group001
272+
replicaset: replicaset001
273+
instance: instance001
251274
...
252275
253276

0 commit comments

Comments
 (0)