Commit 695e2b9
committed
Merge bitcoin/bitcoin#33353: log: show reindex progress in
d7de5b1 logs: show reindex progress in `ImportBlocks` (Lőrinc)
Pull request description:
### Summary
When triggering a reindex, users have no indication of progress.
### Fix
This patch precomputes the total number of block files so progress can be shown.
Instead of only displaying which block file is being processed, it now shows the percent complete.
### Reproducer + expected results
```bash
cmake -B build -DCMAKE_BUILD_TYPE=Release && make -C build -j && ./build/bin/bitcoind -datadir=demo -reindex
```
Before, the block files were shown one-by-one, there's no way to see how much work is left:
```
Reindexing block file blk00000.dat...
Loaded 119920 blocks from external file in 1228ms
Reindexing block file blk00001.dat...
Loaded 10671 blocks from external file in 284ms
Reindexing block file blk00002.dat...
Loaded 5459 blocks from external file in 263ms
Reindexing block file blk00003.dat...
Loaded 5595 blocks from external file in 267ms
```
After the change we add a percentage:
```
Reindexing block file blk00000.dat (0% complete)...
Loaded 119920 blocks from external file in 1255ms
Reindexing block file blk00001.dat (1% complete)...
Loaded 10671 blocks from external file in 303ms
Reindexing block file blk00002.dat (2% complete)...
Loaded 5459 blocks from external file in 278ms
Reindexing block file blk00003.dat (3% complete)...
Loaded 5595 blocks from external file in 285ms
```
ACKs for top commit:
enirox001:
Concept ACK d7de5b1
rkrux:
lgtm ACK d7de5b1
danielabrozzoni:
tACK d7de5b1 - code reviewed and tested on my archival node.
maflcko:
review ACK d7de5b1 💇
Tree-SHA512: 359a539b781ad8b73e2a616c951567062a76be27cf90e5b88bb5309295af9cd7994e327f185bacc1482b43b892b38329593b4043a5e71d8800e3e4b7a3954310ImportBlocks
1 file changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1247 | 1247 | | |
1248 | 1248 | | |
1249 | 1249 | | |
1250 | | - | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
1251 | 1255 | | |
1252 | 1256 | | |
1253 | 1257 | | |
1254 | | - | |
| 1258 | + | |
| 1259 | + | |
1255 | 1260 | | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | 1261 | | |
1260 | 1262 | | |
1261 | 1263 | | |
1262 | 1264 | | |
1263 | | - | |
| 1265 | + | |
1264 | 1266 | | |
1265 | 1267 | | |
1266 | 1268 | | |
1267 | 1269 | | |
1268 | 1270 | | |
1269 | | - | |
1270 | 1271 | | |
1271 | 1272 | | |
1272 | 1273 | | |
| |||
0 commit comments