tests: Handle BDB dynamic pagesize #31222

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:test-bdb-pagesize changing 1 files +7 −4
  1. achow101 commented at 5:55 pm on November 5, 2024: member

    BDB may choose to use a pagesize other than 4096. As such, the parser should use the pagesize given by the BDB file.

    Fixes #31210

  2. tests: Handle BDB dynamic pagesize
    BDB may choose to use a pagesize other than 4096. As such, the parser
    should use the pagesize given by the BDB file.
    74ff8467d1
  3. DrahtBot commented at 5:55 pm on November 5, 2024: 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/31222.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK theStack

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30125 (test: improve BDB parser (handle internal/overflow pages, support all page sizes) by theStack)

    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.

  4. DrahtBot added the label Tests on Nov 5, 2024
  5. in test/functional/test_framework/bdb.py:135 in 74ff8467d1
    130@@ -132,10 +131,14 @@ def dump_bdb_kv(filename):
    131     # Read in the BDB file and start deserializing it
    132     pages = []
    133     with open(filename, 'rb') as f:
    134-        data = f.read(PAGESIZE)
    135+        # Read the outer meta page for the page size. It will always be at least 512 bytes.
    136+        metadata = dump_meta_page(f.read(MIN_PAGESIZE))
    


    laanwj commented at 10:44 am on November 6, 2024:

    Might want to do some basic checks on the pagesize; eg

    0MIN_PAGESIZE = 512
    1MAX_PAGESIZE = 65536
    2
    3assert pagesize >= MIN_PAGESIZE and pagesize <= MAX_PAGESIZE and (pagesize & (pagesize-1) == 0)
    
  6. theStack commented at 12:59 pm on November 6, 2024: contributor

    Concept ACK

    Note that a similar change is also included in #30125, but happy to rebase if this one goes in first.

  7. achow101 commented at 9:10 pm on November 6, 2024: member

    Note that a similar change is also included in #30125,

    Oh, right, forgot about that PR. Closing in favor of it.

  8. achow101 closed this on Nov 6, 2024


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: 2024-11-21 09:12 UTC

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