aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2018-07-13 20:12:16 -0700
committerPieter Wuille <[email protected]>2018-07-13 20:16:41 -0700
commit9a1ad2c5cbdfa3114d05df57103c34f72e087f26 (patch)
treed9c9837ad20655a892d5843dda7798cf8a4f8326 /src
parentMerge #13417: [net] Tighten scope in net_processing (diff)
parentDuring IBD, when doing pruning, prune 10% extra to avoid pruning again soon a... (diff)
downloaddiscoin-9a1ad2c5cbdfa3114d05df57103c34f72e087f26.tar.xz
discoin-9a1ad2c5cbdfa3114d05df57103c34f72e087f26.zip
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')
-rw-r--r--src/validation.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 9921063a5..811530d40 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;