kernel: Move kernel-specific cache size options to kernel
Summary:
Carrying non-kernel related fields in the cache sizes for the indexes is
confusing for kernel library users. The cache sizes also are set
currently with magic numbers in bitcoin-chainstate. The comments for the
cache size calculations are also not completely clear.
Solve these things by moving the kernel-specific cache size fields to
their own struct.
This slightly changes the way the cache is allocated if the txindex
and/or blockfilterindex is used. Since they are now given precedence
over the block tree db cache, this results in a bit less cache being
allocated to the block tree db, coinsdb and coins caches. The effect is
negligible though, i.e. cache sizes with default dbcache reported
through the logs are:
master:
Cache configuration:
- Using 2.0 MiB for block index database
- Using 56.0 MiB for transaction index database
- Using 49.0 MiB for basic block filter index database
- Using 8.0 MiB for chain state database
- Using 335.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
this branch:
Cache configuration:
- Using 2.0 MiB for block index database
- Using 56.2 MiB for transaction index database
- Using 49.2 MiB for basic block filter index database
- Using 8.0 MiB for chain state database
- Using 334.5 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
This is a partial backport of core#31483
github.com/bitcoin/bitcoin/pull/31483/commits/e758b26b85da27ef44f3d2c924f3f08e8c1f4fdf
Depends on D18580
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D18581