Skip to content

Commit

Permalink
Add docs on pruning in Fluffy (#2137)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeme authored Apr 17, 2024
1 parent 6c1afe1 commit d0ac3a1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fluffy/docs/the_fluffy_book/docs/db_pruning.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions fluffy/docs/the_fluffy_book/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ nav:
- Portal bridge:
- 'history-content-bridging.md'
- 'beacon-content-bridging.md'
- 'db_pruning.md'

- Developers:
- 'basics-for-developers.md'
Expand Down

0 comments on commit d0ac3a1

Please sign in to comment.