From d0ac3a198679dfdea507d8ccc77ade74b5605c1d Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Wed, 17 Apr 2024 14:06:53 +0200 Subject: [PATCH] Add docs on pruning in Fluffy (#2137) --- .../docs/the_fluffy_book/docs/db_pruning.md | 30 +++++++++++++++++++ fluffy/docs/the_fluffy_book/mkdocs.yml | 1 + 2 files changed, 31 insertions(+) create mode 100644 fluffy/docs/the_fluffy_book/docs/db_pruning.md diff --git a/fluffy/docs/the_fluffy_book/docs/db_pruning.md b/fluffy/docs/the_fluffy_book/docs/db_pruning.md new file mode 100644 index 0000000000..25e57fb007 --- /dev/null +++ b/fluffy/docs/the_fluffy_book/docs/db_pruning.md @@ -0,0 +1,30 @@ +# Database pruning + +Default Fluffy runs with a specific storage capacity (`--storage-capacity=x`, default set to 2GB). This means that the node's radius is dynamically adjusted to not exceed the configured capacity. As soon as the storage capacity is to be exceeded the pruning of content takes place and a new smaller radius is set. + +As long as the configured storage capacity remains the same, pruning is done +automatically. + +In case the storage capacity of a Fluffy node is changed, a manual step might +be required. There are two scenarios possible: +- Adjusting to a higher storage capacity +- Adjusting to a lower storage capacity + +## Adjusting to a higher storage capacity + +This requires no manual steps as no pruning will be required. On the restart of the Fluffy node with a higher configured storage capacity, the initial radius will be increased to the maximum radius until the new storage capacity is reached. Then the automatic pruning will take place and the radius will be decreased. + +## Adjusting to a lower storage capacity + +When a Fluffy node is restarted with a lower storage capacity, pruning will take +place automatically. The database will be pruned in intervals until the storage +drops under the newly configured storage capacity. The radius will also be adjusted with each pruning cycle. + +However, on disk the database will not lower in size. This is because empty +pages are kept in the SQL database until a [vacuum command](https://www.sqlite.org/lang_vacuum.html) is done. +To do this you can run the `--force-prune` option at start-up. Note that this will temporarily double the database storage capacity as a temporary copy of the database needs to be made. +Because of this, the vacuum is not executed automatically but requires you to manually enable the `--force-prune` flag. + +You can also use the `fcli_db` tool its `prune` command on the database directly to force this vacuuming. + +Another simple but more drastic solution is to delete the `db` subdirectory in the `--data-dir` provided to your Fluffy node. This will start your Fluffy node with a fresh database. diff --git a/fluffy/docs/the_fluffy_book/mkdocs.yml b/fluffy/docs/the_fluffy_book/mkdocs.yml index ce02acbc71..f85b7a55c4 100644 --- a/fluffy/docs/the_fluffy_book/mkdocs.yml +++ b/fluffy/docs/the_fluffy_book/mkdocs.yml @@ -61,6 +61,7 @@ nav: - Portal bridge: - 'history-content-bridging.md' - 'beacon-content-bridging.md' + - 'db_pruning.md' - Developers: - 'basics-for-developers.md'