Summary
Add parallel batch processing with streaming ordered commit to both migration subcommands.
Scope
- Worker pool that processes ledger batches concurrently (each worker: isolated
LedgerBackend, isolated BatchBuffer, processes ledgers sequentially within batch)
- Ordered commit buffer: committer goroutine writes completed batches to DB in order (maintains
nextToCommit counter, buffers out-of-order results until their turn)
- Each batch commit: CAS-advance respective cursor + write batch data in atomic transaction. CAS fail at any point → handoff detected, stop.
- Different parallelization modes:
- History migration: batches are truly independent (state changes for N don't depend on N-1), can be more aggressively parallelized
- Current-state migration: must commit in order (additive state), but processing is still parallel
- Crash recovery: on restart, resume from cursor + 1 (no work lost)
Dependencies
Reference
docs/feature-design/data-migrations.md (State Production section, line 619+)
Summary
Add parallel batch processing with streaming ordered commit to both migration subcommands.
Scope
LedgerBackend, isolatedBatchBuffer, processes ledgers sequentially within batch)nextToCommitcounter, buffers out-of-order results until their turn)Dependencies
Reference
docs/feature-design/data-migrations.md(State Production section, line 619+)