validation: make the “rolling forward” loop interruptible #33442

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/interrupt-rolling-forward changing 1 files +1 −0
  1. l0rinc commented at 5:41 am on September 20, 2025: contributor

    Summary

    Restarting an unsuccessful reindex can result in replay of previously indexed blocks. This process can take many hours and is currently not interruptible.

    Reproducer:

    • start a normal ibd, stop after some progress
    • do a reindex, stop before it finishes
    • restart the node normally without specifying the reindex parameter It should start rolling the blocks forward.

    After this change you should be able to interrupt the process:

    02025-09-20T05:35:42Z Rolling forward 000000002f4f55aecfccc911076dc3f73ac0288c83dc1d79db0a026441031d40 (46245)
    12025-09-20T05:35:42Z Rolling forward 0000000017ffcf34c8eac010c529670ba6745ea59cf1edf7b820928e3b40acf6 (46246)
    2^C2025-09-20T05:35:42Z Rolling forward 000000002857934511131e0800ac1dcbe3ae7873b715a9528747f29ae090b0d4 (46247)
    32025-09-20T05:35:42Z [error] Unable to replay blocks. You will need to rebuild the database using -reindex-chainstate.
    4Error: Unable to replay blocks. You will need to rebuild the database using -reindex-chainstate.
    52025-09-20T05:35:42Z Shutdown in progress...
    62025-09-20T05:35:42Z scheduler thread exit
    72025-09-20T05:35:42Z Shutdown done
    
  2. validation: make the "rolling forward" loop interruptible
    Reproducer:
    * start a normal ibd, stop after some progress
    * do a reindex, stop before it finishes
    * restart the node normally without specifying the reindex parameter
    It should start rolling the blocks forward.
    
    After this change you should be able to interrupt the process:
    ```
    2025-09-20T05:35:42Z Rolling forward 000000002f4f55aecfccc911076dc3f73ac0288c83dc1d79db0a026441031d40 (46245)
    2025-09-20T05:35:42Z Rolling forward 0000000017ffcf34c8eac010c529670ba6745ea59cf1edf7b820928e3b40acf6 (46246)
    ^C2025-09-20T05:35:42Z Rolling forward 000000002857934511131e0800ac1dcbe3ae7873b715a9528747f29ae090b0d4 (46247)
    2025-09-20T05:35:42Z [error] Unable to replay blocks. You will need to rebuild the database using -reindex-chainstate.
    Error: Unable to replay blocks. You will need to rebuild the database using -reindex-chainstate.
    2025-09-20T05:35:42Z Shutdown in progress...
    2025-09-20T05:35:42Z scheduler thread exit
    2025-09-20T05:35:42Z Shutdown done
    ```
    f74c8ea601
  3. DrahtBot added the label Validation on Sep 20, 2025
  4. DrahtBot commented at 5:41 am on September 20, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33442.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  5. mzumsande commented at 6:06 am on September 20, 2025: contributor

    I did this in #30155 a while back, but in a way such that any partial progress would be saved, and we continue with the next startup.

    In any case, now that we flush every hour it’s probably a less pressing issue.

  6. l0rinc commented at 6:09 am on September 20, 2025: contributor
  7. l0rinc closed this on Sep 20, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-09-26 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me