Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

box.ctl.on_recovery_state()

on_recovery_state(trigger-function)

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.

Parameters:

  • trigger-function (function) — a trigger function

Returns

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.

Example:

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)    log.info(state .. ' state reached')endbox.ctl.on_recovery_state(log_recovery_state)