File tree 3 files changed +11
-11
lines changed
3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 12
12
#include < algorithm>
13
13
#include < string>
14
14
15
+ // Unlike for the UTXO database, for the txindex scenario the leveldb cache make
16
+ // a meaningful difference: https://github.com/bitcoin/bitcoin/pull/8273#issuecomment-229601991
17
+ // ! Max memory allocated to tx index DB specific cache in MiB.
18
+ static constexpr int64_t MAX_TX_INDEX_CACHE{1024 };
19
+ // ! Max memory allocated to all block filter index caches combined in MiB.
20
+ static constexpr int64_t MAX_FILTER_INDEX_CACHE{1024 };
21
+
15
22
namespace node {
16
23
CacheSizes CalculateCacheSizes (const ArgsManager& args, size_t n_indexes)
17
24
{
18
25
int64_t nTotalCache = (args.GetIntArg (" -dbcache" , nDefaultDbCache) << 20 );
19
26
nTotalCache = std::max (nTotalCache, nMinDbCache << 20 ); // total cache cannot be less than nMinDbCache
20
27
IndexCacheSizes sizes;
21
- sizes.tx_index = std::min (nTotalCache / 8 , args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX) ? nMaxTxIndexCache << 20 : 0 );
28
+ sizes.tx_index = std::min (nTotalCache / 8 , args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX) ? MAX_TX_INDEX_CACHE << 20 : 0 );
22
29
nTotalCache -= sizes.tx_index ;
23
30
if (n_indexes > 0 ) {
24
- int64_t max_cache = std::min (nTotalCache / 8 , max_filter_index_cache << 20 );
31
+ int64_t max_cache = std::min (nTotalCache / 8 , MAX_FILTER_INDEX_CACHE << 20 );
25
32
sizes.filter_index = max_cache / n_indexes;
26
33
nTotalCache -= sizes.filter_index * n_indexes;
27
34
}
Original file line number Diff line number Diff line change 8
8
#include < kernel/caches.h>
9
9
10
10
#include < cstddef>
11
- #include < cstdint>
12
11
13
12
class ArgsManager ;
14
13
15
14
namespace node {
16
15
struct IndexCacheSizes {
17
- int64_t tx_index{0 };
18
- int64_t filter_index{0 };
16
+ size_t tx_index{0 };
17
+ size_t filter_index{0 };
19
18
};
20
19
struct CacheSizes {
21
20
IndexCacheSizes index;
Original file line number Diff line number Diff line change @@ -27,12 +27,6 @@ static const int64_t nDefaultDbCache = 450;
27
27
static const int64_t nDefaultDbBatchSize = 16 << 20 ;
28
28
// ! min. -dbcache (MiB)
29
29
static const int64_t nMinDbCache = 4 ;
30
- // Unlike for the UTXO database, for the txindex scenario the leveldb cache make
31
- // a meaningful difference: https://github.com/bitcoin/bitcoin/pull/8273#issuecomment-229601991
32
- // ! Max memory allocated to tx index DB specific cache in MiB.
33
- static const int64_t nMaxTxIndexCache = 1024 ;
34
- // ! Max memory allocated to all block filter index caches combined in MiB.
35
- static const int64_t max_filter_index_cache = 1024 ;
36
30
37
31
// ! User-controlled performance and debug options.
38
32
struct CoinsViewOptions {
You can’t perform that action at this time.
0 commit comments