mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-28 02:03:32 +00:00
Switch default slasher backend to LMDB (#4360)
## Issue Addressed Closes #4354 Closes #3987 Replaces #4305, #4283 ## Proposed Changes This switches the default slasher backend _back_ to LMDB. If an MDBX database exists and the MDBX backend is enabled then MDBX will continue to be used. Our release binaries and Docker images will continue to include MDBX for as long as it is practical, so users of these should not notice any difference. The main benefit is to users compiling from source and devs running tests. These users no longer have to struggle to compile MDBX and deal with the compatibility issues that arises. Similarly, devs don't need to worry about toggling feature flags in tests or risk forgetting to run the slasher tests due to backend issues.
This commit is contained in:
@@ -5,7 +5,7 @@ the instructions below, and then proceed to [Building Lighthouse](#build-lightho
|
||||
|
||||
## Dependencies
|
||||
|
||||
First, **install Rust** using [rustup](https://rustup.rs/):
|
||||
First, **install Rust** using [rustup](https://rustup.rs/):
|
||||
|
||||
```bash
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
@@ -64,10 +64,10 @@ After this, you are ready to [build Lighthouse](#build-lighthouse).
|
||||
|
||||
1. Install [Git](https://git-scm.com/download/win).
|
||||
1. Install the [Chocolatey](https://chocolatey.org/install) package manager for Windows.
|
||||
> Tips:
|
||||
> Tips:
|
||||
> - Use PowerShell to install. In Windows, search for PowerShell and run as administrator.
|
||||
> - You must ensure `Get-ExecutionPolicy` is not Restricted. To test this, run `Get-ExecutionPolicy` in PowerShell. If it returns `restricted`, then run `Set-ExecutionPolicy AllSigned`, and then run
|
||||
```bash
|
||||
```bash
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
```
|
||||
> - To verify that Chocolatey is ready, run `choco` and it should return the version.
|
||||
@@ -159,13 +159,13 @@ Commonly used features include:
|
||||
* `gnosis`: support for the Gnosis Beacon Chain.
|
||||
* `portable`: support for legacy hardware.
|
||||
* `modern`: support for exclusively modern hardware.
|
||||
* `slasher-mdbx`: support for the MDBX slasher backend. Enabled by default.
|
||||
* `slasher-lmdb`: support for the LMDB slasher backend.
|
||||
* `slasher-lmdb`: support for the LMDB slasher backend. Enabled by default.
|
||||
* `slasher-mdbx`: support for the MDBX slasher backend.
|
||||
* `jemalloc`: use [`jemalloc`][jemalloc] to allocate memory. Enabled by default on Linux and macOS.
|
||||
Not supported on Windows.
|
||||
* `spec-minimal`: support for the minimal preset (useful for testing).
|
||||
|
||||
Default features (e.g. `slasher-mdbx`) may be opted out of using the `--no-default-features`
|
||||
Default features (e.g. `slasher-lmdb`) may be opted out of using the `--no-default-features`
|
||||
argument for `cargo`, which can be plumbed in via the `CARGO_INSTALL_EXTRA_FLAGS` environment variable.
|
||||
E.g.
|
||||
|
||||
|
||||
@@ -46,23 +46,49 @@ directory.
|
||||
|
||||
* Flag: `--slasher-backend NAME`
|
||||
* Argument: one of `mdbx`, `lmdb` or `disabled`
|
||||
* Default: `mdbx`
|
||||
* Default: `lmdb` for new installs, `mdbx` if an MDBX database already exists
|
||||
|
||||
Since Lighthouse v2.6.0 it is possible to use one of several database backends with the slasher:
|
||||
It is possible to use one of several database backends with the slasher:
|
||||
|
||||
- MDBX (default)
|
||||
- LMDB
|
||||
- LMDB (default)
|
||||
- MDBX
|
||||
|
||||
The advantage of MDBX is that it performs compaction, resulting in less disk usage over time. The
|
||||
disadvantage is that upstream MDBX has removed support for Windows and macOS, so Lighthouse is stuck
|
||||
on an older version. If bugs are found in our pinned version of MDBX it may be deprecated in future.
|
||||
disadvantage is that upstream MDBX is unstable, so Lighthouse is pinned to a specific version.
|
||||
If bugs are found in our pinned version of MDBX it may be deprecated in future.
|
||||
|
||||
LMDB does not have compaction but is more stable upstream than MDBX. It is not currently recommended
|
||||
to use the LMDB backend on Windows.
|
||||
LMDB does not have compaction but is more stable upstream than MDBX. If running with the LMDB
|
||||
backend on Windows it is recommended to allow extra space due to this issue:
|
||||
[sigp/lighthouse#2342](https://github.com/sigp/lighthouse/issues/2342).
|
||||
|
||||
More backends may be added in future.
|
||||
|
||||
### Switching Backends
|
||||
#### Backend Override
|
||||
|
||||
The default backend was changed from MDBX to LMDB in Lighthouse v4.3.0.
|
||||
|
||||
If an MDBX database is already found on disk, then Lighthouse will try to use it. This will result
|
||||
in a log at start-up:
|
||||
|
||||
```
|
||||
INFO Slasher backend overriden reason: database exists, configured_backend: lmdb, overriden_backend: mdbx
|
||||
```
|
||||
|
||||
If the running Lighthouse binary doesn't have the MDBX backend enabled but an existing database is
|
||||
found, then a warning will be logged and Lighthouse will use the LMDB backend and create a new database:
|
||||
|
||||
```
|
||||
WARN Slasher backend override failed advice: delete old MDBX database or enable MDBX backend, path: /home/user/.lighthouse/mainnet/beacon/slasher_db/mdbx.dat
|
||||
```
|
||||
|
||||
In this case you should either obtain a Lighthouse binary with the MDBX backend enabled, or delete
|
||||
the files for the old backend. The pre-built Lighthouse binaries and Docker images have MDBX enabled,
|
||||
or if you're [building from source](./installation-source.md) you can enable the `slasher-mdbx` feature.
|
||||
|
||||
To delete the files, use the `path` from the `WARN` log, and then delete the `mbdx.dat` and
|
||||
`mdbx.lck` files.
|
||||
|
||||
#### Switching Backends
|
||||
|
||||
If you change database backends and want to reclaim the space used by the old backend you can
|
||||
delete the following files from your `slasher_db` directory:
|
||||
|
||||
Reference in New Issue
Block a user