Commit e270286
committed
Merge #7101: feat!: migrate additional indexes from synchronous to async operation
cc1dd3c fix: harden index migration and document timestampindex prune caveat (UdjinM6)
0695e97 refactor: move BlockDisconnected handling to BaseIndex (UdjinM6)
c41584e refactor: move BlockUntilSyncedToCurrentChain from index queries to RPC callers (UdjinM6)
1ca7374 fix: harden BlockDisconnected sibling check and getaddressbalance height race (UdjinM6)
386acdf fix: add undo data size validation in AddressIndex::Rewind (UdjinM6)
5796588 fix: reverse transaction processing order in AddressIndex::Rewind (UdjinM6)
8f3f62b fix: add vtxundo size validation in SpentIndex::WriteBlock (UdjinM6)
97dcc6d fix: address review suggestions (UdjinM6)
331335e fix: add explicit vtxundo size validation and in-class initialization for m_block_height (UdjinM6)
98c3c1b fix: check index sync status before querying and show sync progress (UdjinM6)
e84b1fa feat: add async indexes to getindexinfo RPC (UdjinM6)
5be629b refactor: apply clang-format (UdjinM6)
fd1de98 refactor: address code review feedback (UdjinM6)
5fd7033 docs: add release notes (UdjinM6)
6e5f7ab fix: add missing include in `src/zmq/zmqpublishnotifier.cpp` (UdjinM6)
fa60ccb feat: migrate old synchronous index data to new async index databases (UdjinM6)
fa7be34 feat: add CompactRange template method to CDBWrapper (UdjinM6)
8ad06be test: update feature_addressindex for async behavior (UdjinM6)
18276a6 feat: migrate AddressIndex from synchronous to async operation (UdjinM6)
3ea9394 test: update feature_spentindex for async behavior (UdjinM6)
464cdf8 feat: migrate SpentIndex from synchronous to async operation (UdjinM6)
33d2fc5 test: update timestampindex functional test for async behavior (UdjinM6)
f3fcb97 feat: migrate TimestampIndex from synchronous to async operation (UdjinM6)
Pull request description:
## Issue being fixed or feature implemented
Migrate three Dash-specific indexes (`AddressIndex`, `SpentIndex`, `TimestampIndex`) from synchronous operation in `CBlockTreeDB` to async operation using `BaseIndex` framework.
When enabling an index for the first time, the node will build the index in the background while remaining fully operational. Progress can be monitored via the `getindexinfo` RPC.
Existing nodes with indexes enabled will automatically migrate data from the old location (block index database) to new separate databases on first startup. This migration may take 20-40 minutes or longer depending on hardware specifications and index sizes. The node will log progress during migration.
## What was done?
Architecture Improvements:
- Indexes now derive from `BaseIndex`, enabling async catch-up during IBD
- Each index has its own database under `indexes/{addressindex,spentindex,timestampindex}/`
- No longer blocks validation during index updates
- Can be enabled/disabled without `-reindex`
Migration System:
- Template-based `MigrateIndex<>()` function handles data migration
- Threshold-based incremental compaction (256 MiB) to reclaim disk space
- Iterator reset before compaction to allow LevelDB file deletion
- Best block locator written to ensure index consistency
## How Has This Been Tested?
Run tests. Run a testnet/mainnet node and confirm migration succeeds (backup old datadir cause otherwise you'd have to reindex to go back to develop/master binaries).
## Breaking Changes
- `SpentIndex` and `AddressIndex` are incompatible with pruned nodes as they require access to undo data now
- `TimestampIndex` can no longer be enabled on a datadir where pruning has already occurred. It still works when started together with `-prune` from a fresh sync or reindex (the index is built forward as blocks arrive), but enabling it on an existing pre-pruned datadir now fails at startup. The old synchronous implementation built forward from the current tip and accepted that case
## Checklist:
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e tests
- [ ] I have made corresponding changes to the documentation
- [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
Top commit has no ACKs.
Tree-SHA512: b0129ffdec086883c7a8a10fbeec891b6588523e567d1fc083da96eef53b2bf2c72d4249f0d8420174b03bc58652a9fa68ecdb3e55dc9160b0630dda0f282d7e47 files changed
Lines changed: 2029 additions & 1130 deletions
File tree
- doc
- src
- index
- node
- rpc
- test/util
- zmq
- test
- functional
- lint
- util/data
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
250 | 248 | | |
251 | 249 | | |
252 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
257 | 262 | | |
258 | 263 | | |
259 | 264 | | |
| |||
348 | 353 | | |
349 | 354 | | |
350 | 355 | | |
351 | | - | |
352 | 356 | | |
353 | 357 | | |
354 | 358 | | |
| |||
383 | 387 | | |
384 | 388 | | |
385 | 389 | | |
386 | | - | |
387 | 390 | | |
388 | 391 | | |
389 | 392 | | |
| |||
488 | 491 | | |
489 | 492 | | |
490 | 493 | | |
491 | | - | |
492 | 494 | | |
493 | 495 | | |
494 | 496 | | |
| |||
534 | 536 | | |
535 | 537 | | |
536 | 538 | | |
| 539 | + | |
| 540 | + | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
| 544 | + | |
| 545 | + | |
540 | 546 | | |
541 | 547 | | |
542 | 548 | | |
| |||
599 | 605 | | |
600 | 606 | | |
601 | 607 | | |
602 | | - | |
603 | 608 | | |
604 | 609 | | |
605 | 610 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
395 | 411 | | |
396 | 412 | | |
397 | 413 | | |
| |||
0 commit comments