Skip to content

Commit 9a1ad2c

Browse files
committed
Merge #11658: During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after
ac51a26 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
2 parents 1e90862 + ac51a26 commit 9a1ad2c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/validation.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,6 +3729,15 @@ static void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfte
37293729
int count=0;
37303730

37313731
if (nCurrentUsage + nBuffer >= nPruneTarget) {
3732+
// On a prune event, the chainstate DB is flushed.
3733+
// To avoid excessive prune events negating the benefit of high dbcache
3734+
// values, we should not prune too rapidly.
3735+
// So when pruning in IBD, increase the buffer a bit to avoid a re-prune too soon.
3736+
if (IsInitialBlockDownload()) {
3737+
// Since this is only relevant during IBD, we use a fixed 10%
3738+
nBuffer += nPruneTarget / 10;
3739+
}
3740+
37323741
for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) {
37333742
nBytesToPrune = vinfoBlockFile[fileNumber].nSize + vinfoBlockFile[fileNumber].nUndoSize;
37343743

0 commit comments

Comments
 (0)