leveldb: show non-default options during init #31644

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/leveldb-options-logging changing 1 files +44 −2
  1. l0rinc commented at 5:30 PM on January 12, 2025: contributor

    To help with to debugging and traceability (in alignment with displaying other non-default args such as Command-line arg: dbcache="10000") we can extend the LevelDB opening log with an additional debug message for the used non-default settings.

    To avoid showing booleans as e.g. create_if_missing=1, I've added a local ToString lambda for bool. I wanted to use util::Join at the end, but couldn't find any way that I liked.

    Example output after the change:

    2025-10-15T02:39:45Z Opened LevelDB successfully
    2025-10-15T02:39:45Z [leveldb] startup options: options.compression=NoCompression, options.create_if_missing=true, options.max_file_size=33554432, options.paranoid_checks=true, options.write_buffer_size=524288, readoptions.fill_cache=false, readoptions.verify_checksums=true, writeoptions.sync=true
    
  2. DrahtBot commented at 5:30 PM on January 12, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK pablomartin4btc

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. l0rinc force-pushed on Jan 12, 2025
  4. DrahtBot commented at 5:45 PM on January 12, 2025: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Debug: https://github.com/bitcoin/bitcoin/runs/35494695770</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  5. DrahtBot added the label CI failed on Jan 12, 2025
  6. DrahtBot removed the label CI failed on Jan 12, 2025
  7. luke-jr commented at 9:53 PM on January 14, 2025: member

    How is this useful?

  8. l0rinc commented at 11:18 AM on January 16, 2025: contributor

    How is this useful?

    I've extended the description with more details.

    <details> <summary>Details</summary>

    2025-01-16T10:47:35Z Opening LevelDB in /Users/lorinc/Library/Application Support/Bitcoin/blocks/index
    2025-01-16T10:47:35Z Opened LevelDB successfully with options: options.compression=NoCompression, options.create_if_missing=true, options.max_file_size=33554432, options.paranoid_checks=true, options.write_buffer_size=524288, readoptions.fill_cache=false, readoptions.verify_checksums=true, writeoptions.sync=true
    ...
    2025-01-16T10:47:51Z Opening LevelDB in /Users/lorinc/Library/Application Support/Bitcoin/chainstate
    2025-01-16T10:47:51Z Opened LevelDB successfully with options: options.compression=NoCompression, options.create_if_missing=true, options.max_file_size=33554432, options.paranoid_checks=true, options.write_buffer_size=2097152, readoptions.fill_cache=false, readoptions.verify_checksums=true, writeoptions.sync=true
    

    E.g. dbwrapper_tests/dbwrapper shows

    options.compression=NoCompression, options.create_if_missing=true, options.max_file_size=33554432, options.paranoid_checks=true, options.write_buffer_size=262144, readoptions.fill_cache=false, readoptions.verify_checksums=true, writeoptions.sync=true
    

    </details>

    Logging the non-default LevelDB options during initialization makes it easier to understand and debug database behavior. For example, the blocks/index and chainstate databases already use different write_buffer_size values (512KiB vs. 2MiB) - optimized for their specific workloads (which are expected to diverge further the more we fine-tune them).

    Logging these differences helps trace configuration changes, especially when command-line arguments (such as -dbcache or -dbbatchsize) can influence the settings.

  9. DrahtBot added the label Needs rebase on Jul 25, 2025
  10. l0rinc force-pushed on Jul 28, 2025
  11. DrahtBot removed the label Needs rebase on Jul 28, 2025
  12. pablomartin4btc commented at 9:44 PM on October 13, 2025: member

    Concept ACK

    Perhaps the legend "with options: ..." could be debug log? Ideally in the same line but I don't think we support it actually. As an alternative (haven't tested it) maybe:

    const bool log_options = LogAcceptCategory(BCLog::LEVELDB, BCLog::Level::Debug);
    
    LogInfo("Opened LevelDB successfully%s", 
        log_options
            ? tfm::format(" with options: %s", GetChangedOptions(DBContext()))
            : "");
    
  13. l0rinc force-pushed on Oct 15, 2025
  14. l0rinc commented at 2:36 AM on October 15, 2025: contributor

    Thanks for the hint @pablomartin4btc, I kept the original line and added and extra debug log, when starting with -debug=leveldb.

  15. l0rinc force-pushed on Oct 15, 2025
  16. DrahtBot added the label Needs rebase on Feb 8, 2026
  17. l0rinc force-pushed on Feb 8, 2026
  18. DrahtBot removed the label Needs rebase on Feb 8, 2026
  19. DrahtBot added the label CI failed on Feb 8, 2026
  20. DrahtBot commented at 9:17 AM on February 8, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task lint: https://github.com/bitcoin/bitcoin/actions/runs/21794054901/job/62880530991</sub> <sub>LLM reason (✨ experimental): Lint failure: duplicate #include lines in src/dbwrapper.cpp triggered lint-includes.py, causing the lint-all step to fail.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  21. leveldb: show non-default options during init
    Example output, if started with `-debug=leveldb`:
    > Opened LevelDB successfully
    > [leveldb] startup options: options.compression=NoCompression, options.create_if_missing=true, options.max_file_size=33554432, options.paranoid_checks=true, options.write_buffer_size=524288, readoptions.fill_cache=false, readoptions.verify_checksums=true, writeoptions.sync=true
    91397a6e6b
  22. l0rinc force-pushed on Feb 8, 2026
  23. DrahtBot removed the label CI failed on Feb 8, 2026
  24. sedited commented at 4:55 PM on February 20, 2026: contributor

    For the simple change that this is, it has not received significant review in a while. Maybe interest in this change is not strong enough?

  25. l0rinc closed this on Feb 20, 2026


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: 2026-05-03 06:13 UTC

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