aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-07-13 20:12:16 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-07-13 20:16:41 -0700
commit9a1ad2c5cbdfa3114d05df57103c34f72e087f26 (patch)
treed9c9837ad20655a892d5843dda7798cf8a4f8326 /src/validation.cpp
parent1e90862f5d0b5f7dcc18fb018b2bbaa323dcca1d (diff)
parentac51a26bdc69dc35e1f4f89b62c3134047e93bc1 (diff)
downloadbitcoin-9a1ad2c5cbdfa3114d05df57103c34f72e087f26.tar.xz
Merge #11658: During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after
ac51a26bdc During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after (Luke Dashjr) Pull request description: Pruning forces a chainstate flush, which can defeat the dbcache and harm performance significantly. Alternative to #11359 Tree-SHA512: 631e4e8f94f5699e98a2eff07204aa2b3b2325b2d92e8236b8c8d6a6730737a346e0ad86024e705f5a665b25e873ab0970ce7396740328a437c060f99e9ba4d9
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 9921063a52..811530d40e 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3729,6 +3729,15 @@ static void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfte
int count=0;
if (nCurrentUsage + nBuffer >= nPruneTarget) {
+ // On a prune event, the chainstate DB is flushed.
+ // To avoid excessive prune events negating the benefit of high dbcache
+ // values, we should not prune too rapidly.
+ // So when pruning in IBD, increase the buffer a bit to avoid a re-prune too soon.
+ if (IsInitialBlockDownload()) {
+ // Since this is only relevant during IBD, we use a fixed 10%
+ nBuffer += nPruneTarget / 10;
+ }
+
for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) {
nBytesToPrune = vinfoBlockFile[fileNumber].nSize + vinfoBlockFile[fileNumber].nUndoSize;