box.ctl.on_recovery_state() | Tarantool
Документация на русском языке
поддерживается сообществом



Since: 2.11.0

Create a trigger executed on different stages of a node recovery or initial configuration. Note that you need to set the box.ctl.on_recovery_state trigger before the initial box.cfg call.

  • trigger-function (function) – a trigger function

nil or a function pointer

A registered trigger function is run on each of the supported recovery state and receives the state name as a parameter:

  • snapshot_recovered: the node has recovered the snapshot files.
  • wal_recovered: the node has recovered the WAL files.
  • indexes_built: the node has built secondary indexes for memtx spaces. This stage might come before any actual data is recovered. This means that the indexes are available right after the first tuple is recovered.
  • synced: the node has synced with enough remote peers. This means that the node changes the state from orphan to running.

All these states are passed during the initial box.cfg call when recovering from the snapshot and WAL files. Note that the synced state might be reached after the initial box.cfg call finishes. For example, if replication_sync_timeout is set to 0, the node finishes box.cfg without reaching synced and stays orphan. Once the node is synced with enough remote peers, the synced state is reached.


When bootstrapping a fresh cluster with no data, all the instances in this cluster execute triggers on the same stages for consistency. For example, snapshot_recovered and wal_recovered run when the node finishes a cluster’s bootstrap or finishes joining to an existing cluster.


The example below shows how to log a specified message when each state is reached.

local log = require('log')
local log_recovery_state = function(state) .. ' state reached')
Нашли ответ на свой вопрос?
Обратная связь