Skip to content

Conversation

@heifner
Copy link
Contributor

@heifner heifner commented Apr 28, 2025

When syncing, a node can load up the fork database with many blocks ahead of the current head. The terminate-at-block option terminates when the head reaches the specified terminate-at-block. On restart of the node after terminate-at-block this can be confusing as the node can process the blocks out of the fork database on restart. To avoid having these extra blocks in the fork database on shutdown, truncate-at-block can now be specified along with terminate-at-block. On shutdown due to a terminate-at-block, if truncate-at-block is specified then the fork database will have all blocks beyond truncate-at-block removed.

  --truncate-at-block arg (=0)          Stop hard replay / block log recovery
                                        at this block number (if non-zero). Can
                                        also be used with terminate-at-block to
                                        prune any received blocks from fork
                                        database on exit.
  --terminate-at-block arg (=0)         Stops the node after reaching the
                                        specified block number (if non-zero).
                                        Use RPC endpoint /v1/producer/pause_at_
                                        block to pause at a specific block
                                        instead. Combine with
                                        --truncate-at-block to prune blocks
                                        beyond the specified number from the
                                        fork database on exit.

Note: Existing terminate-scenarios-test.py continues to test terminate-at-block without truncate-at-block. nodeos_read_terminate_at_block_test.py which expects the restarted node not to have extra blocks has been updated to use truncate-at-block with terminate-at-block.

Resolves #1365

@heifner heifner requested review from greg7mdp and linh2931 April 28, 2025 16:17
@heifner heifner added the OCI Work exclusive to OCI team label Apr 28, 2025
@heifner heifner merged commit 3210b04 into main Apr 29, 2025
41 checks passed
@heifner heifner deleted the GH-1365-truncate-terminate branch April 29, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCI Work exclusive to OCI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: nodeos_read_terminate_at_block_if_lr_test

4 participants