Skip to content

Document force recovery #4446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we have some articles that suggest box.cfg({force_recovery = true}). I guess that it should be updated with mention of the CLI option and/or link to it.

Copy link
Contributor Author

@andreyaksenov andreyaksenov Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will create a separate issue for this. (UPD: #4460)


.. 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
Loading