diff options
| author | Luke Dashjr <[email protected]> | 2017-11-11 09:05:36 +0000 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2017-11-11 09:05:48 +0000 |
| commit | ac51a26bdc69dc35e1f4f89b62c3134047e93bc1 (patch) | |
| tree | 35379ab4405cc96acb090fd881b2f1fdfb4eaff3 /src/validation.cpp | |
| parent | Merge #9761: Use 2 hour grace period for key timestamps in importmulti rescans (diff) | |
| download | discoin-ac51a26bdc69dc35e1f4f89b62c3134047e93bc1.tar.xz discoin-ac51a26bdc69dc35e1f4f89b62c3134047e93bc1.zip | |
During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after
Pruning forces a chainstate flush, which can defeat the dbcache and harm performance significantly.
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 4ce0723b2..7f447d4fc 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3391,6 +3391,15 @@ void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight 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; |