Commit d21612f
committed
Merge bitcoin/bitcoin#32404: log: print reason when writing chainstate
53e9b71 log: print reason for why should_write was triggered in `FlushStateToDisk` (Lőrinc)
Pull request description:
This PR addresses a leftover logging nit found while reviewing bitcoin/bitcoin#30611 (review).
This was also needed to validate its behavior properly, because currently there's no way to visualize how often (and why) we're flushing/syncing.
Starting with `-debug=coindb` will now add log lines such as
```
2025-05-03T08:34:57Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T09:26:52Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T10:27:58Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T11:39:20Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T12:41:48Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T13:40:08Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T14:49:16Z [coindb] Writing chainstate to disk: flush mode=PERIODIC, prune=0, large=0, critical=0, periodic=1
2025-05-03T15:14:37Z [coindb] Writing chainstate to disk: flush mode=ALWAYS, prune=0, large=0, critical=0, periodic=0
2025-05-03T15:17:28Z [coindb] Writing chainstate to disk: flush mode=ALWAYS, prune=0, large=0, critical=0, periodic=0
```
ACKs for top commit:
davidgumberg:
ACK bitcoin/bitcoin@53e9b71
jonatack:
diff-only review ACK 53e9b71 per `git range-diff 2df824 cfc8056 53e9b71`
achow101:
ACK 53e9b71
andrewtoth:
utACK 53e9b71
Tree-SHA512: 09f3a38cf3ecaa32cf3aba350a9e9dff9345c5468a05070c8b20987f0fdb23a8b1dc59370829c64ea356d2fc0ce99a66cc7240de7fa8c19ef3133da06db6bf3d2 files changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2874 | 2874 | | |
2875 | 2875 | | |
2876 | 2876 | | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
2877 | 2880 | | |
2878 | 2881 | | |
2879 | 2882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
| 441 | + | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
| |||
0 commit comments