Submodule box.ctl | Tarantool

Submodule box.ctl

The wait_ro (wait until read-only) and wait_rw (wait until read-write) functions are useful during server initialization. To see whether a function is already in read-only or read-write mode, check box.info.ro.

A particular use is for box.once(). For example, when a replica is initializing, it may call a box.once() function while the server is still in read-only mode, and fail to make changes that are necessary only once before the replica is fully initialized. This could cause conflicts between a master and a replica if the master is in read-write mode and the replica is in read-only mode. Waiting until “read only mode = false” solves this problem.

Below is a list of all box.ctl functions.

Name Use
box.ctl.wait_ro() Wait until box.info.ro is true
box.ctl.wait_rw() Wait until box.info.ro is false
box.ctl.on_schema_init() Create a “schema_init trigger”
box.ctl.on_shutdown() Create a “shutdown trigger”
box.ctl.on_recovery_state() Create a trigger executed on different stages of a node recovery or initial configuration
box.ctl.on_election() Create a trigger executed every time the current state of a replica set node in regard to leader election changes
box.ctl.set_on_shutdown_timeout() Set a timeout in seconds for the on_shutdown trigger
box.ctl.is_recovery_finished() Check if recovery has finished
box.ctl.promote() Wait, then choose replication leader
box.ctl.demote() Revoke the leader role from the instance
Found what you were looking for?
Feedback