Skip to content

Commit

Permalink
Document force recovery (#4446)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyaksenov authored Aug 19, 2024
1 parent 0190f4e commit fbc9e1e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Force recovery

A sample application demonstrating how to start an instance with a corrupted write-ahead log file.

## Running

- To start the instance using the `tt` utility, execute the following command in the [config](../../../config) directory:

```console
$ TT_FORCE_RECOVERY=true tt start force_recovery
```

- To start the instance using the `tarantool` command, you can use both the `TT_FORCE_RECOVERY` environment variable and add the `--force-recovery` option.
In the example below, the `tarantool` command is executed in the [config/instances.enabled/force_recovery](../../../config/instances.enabled/force_recovery) directory:

```console
$ tarantool --name instance001 --config config.yaml --force-recovery -i
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
groups:
group001:
replicasets:
replicaset001:
instances:
instance001:
iproto:
listen:
- uri: '127.0.0.1:3301'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
instance001:
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions doc/reference/tarantool_cli_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ Options

Start an external coordinator used for a :ref:`supervised failover <repl_supervised_failover>`.

.. _tarantool_cli_force_recovery:

.. option:: --force-recovery

**Since:** :doc:`3.0.0 </release/3.0.0>`.

Try to start an instance if there is an error while reading a corrupted snapshot or write-ahead log file during the recovery process:

- For a corrupted :ref:`snapshot file <index-box_persistence>` -- at the instance start.
- For a corrupted :ref:`write-ahead log file <internals-wal>` -- at the instance start or when applying an update at a replica.

With this option enabled, Tarantool skips invalid records, reads as much data as possible, and lets the process finish with a warning.
When the instance has started, call :ref:`box.snapshot() <box-snapshot>` to make a new snapshot so that the corrupted snapshots or write-ahead logs aren't used for recovery anymore.

You can also enable force recovery using the ``TT_FORCE_RECOVERY`` environment variable.
``TT_FORCE_RECOVERY`` has a lower priority than the ``--force-recovery`` option.

Example on GitHub: `force_recovery <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/config/instances.enabled/force_recovery>`_

.. _index-tarantool_version:

.. option:: -v, -V, --version
Expand Down

0 comments on commit fbc9e1e

Please sign in to comment.