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 −1
  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 the used 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:

    0025-01-16T10:47:35Z Opening LevelDB in /Users/lorinc/Library/Application Support/Bitcoin/blocks/index
    12025-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
    2...
    32025-01-16T10:47:51Z Opening LevelDB in /Users/lorinc/Library/Application Support/Bitcoin/chainstate
    42025-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
    
  2. DrahtBot commented at 5:30 pm on January 12, 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/31644.

    Reviews

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #29641 (scripted-diff: Use LogInfo over LogPrintf [WIP, NOMERGE, DRAFT] by maflcko)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. leveldb: show non-default options during init
    Example output:
    > 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
    8af25b011b
  4. l0rinc force-pushed on Jan 12, 2025
  5. DrahtBot commented at 5:45 pm on January 12, 2025: contributor

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

    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.

  6. DrahtBot added the label CI failed on Jan 12, 2025
  7. DrahtBot removed the label CI failed on Jan 12, 2025
  8. luke-jr commented at 9:53 pm on January 14, 2025: member
    How is this useful?
  9. l0rinc commented at 11:18 am on January 16, 2025: contributor

    How is this useful?

    I’ve extended the description with more details.

    02025-01-16T10:47:35Z Opening LevelDB in /Users/lorinc/Library/Application Support/Bitcoin/blocks/index
    12025-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
    2...
    32025-01-16T10:47:51Z Opening LevelDB in /Users/lorinc/Library/Application Support/Bitcoin/chainstate
    42025-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

    0options.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
    

    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.


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-01-21 03:12 UTC

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