Skip to content

add option 'block_size' to test configs#18347

Merged
Mytherin merged 7 commits intoduckdb:v1.3-ossivalisfrom
c-herrewijn:block_alloc_size_unittester
Jul 24, 2025
Merged

add option 'block_size' to test configs#18347
Mytherin merged 7 commits intoduckdb:v1.3-ossivalisfrom
c-herrewijn:block_alloc_size_unittester

Conversation

@c-herrewijn
Copy link
Member

@c-herrewijn c-herrewijn commented Jul 21, 2025

This PR adds option block_size to TestConfiguration; and removes the default BLOCK_ALLOC_SIZE from the Makefile.

Since duckdb doesn't have to be recompiled to use different default block size values, there is no need for this flag to be kept in the Makefile or CmakeList.txt

Usage

option block_size can be used to set a default block size for all tests ran with this configuration

{
  "description": "Tests with smallest possible block size",
  "block_size": "16384",
  "skip_compiled": "true"
}

Tests

I ran the following tests to see if it works:

  • all existing tests pass with the test config
    • ./build/release/test/unittest --test-config test/configs/small_block_size.json
  • setting an illegal value (e.g. "block_size": "1234" raises an Error)
  • I added the following test (not committed); this test would normally fail (since the default block size is 262144). With the demo test config, however, it succeeds:
    • ./build/release/test/unittest test/sql/tmp.test --test-config test/configs/small_block_size.json
# name: test/sql/tmp.test
# group: [tmp]

statement ok
ATTACH '__TEST_DIR__/tmp_db.duckdb' AS db1

query I
select block_size from pragma_database_size() where database_name = 'db1';
----
16384

@c-herrewijn c-herrewijn marked this pull request as draft July 21, 2025 15:24
Copy link
Contributor

@taniabogatsch taniabogatsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I like having release tests in Main.yml (if they don't take too long), and relassert in the nightlies. 👍

@c-herrewijn c-herrewijn marked this pull request as ready for review July 22, 2025 14:31
@c-herrewijn
Copy link
Member Author

c-herrewijn commented Jul 22, 2025

I added the following configurations, based on this comment: #18236 (comment)

  • in memory db with block size 16kB:
    • test/configs/small_block_size.json
  • persistent db with block size 16kB:
    • test/configs/latest_storage_block_size_16kB.json

Note that for the configuration with a persistent db, I had to exclude a number of tests that assume the default setting (in-memory db with name 'memory'). A next iteration might be to make that more transparant.

Comment on lines +417 to +421
- name: test/configs/default_storage_block_size_16kB.json
if: (success() || failure()) && steps.build.conclusion == 'success'
shell: bash
run: |
./build/release/test/unittest --test-config test/configs/default_storage_block_size_16kB.json
Copy link
Contributor

@taniabogatsch taniabogatsch Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this for now - it is mostly the same as test/configs/small_block_size.json, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is in-memory vs persistent db, but maybe not so relevant in this context indeed

@@ -0,0 +1,35 @@
{
"description": "Run everything with the latest storage on databases with a default block size of 16kB.",
"on_init": "ATTACH '__TEST_DIR__/{BASE_TEST_NAME}block_size.db' AS __test__config__latest_storage_block_size_16kB (BLOCK_SIZE 16384, STORAGE_VERSION 'latest'); SET storage_compatibility_version='latest';",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we use "block_size": "16384",, then we can shorten this to:

"ATTACH '__TEST_DIR__/{BASE_TEST_NAME}block_size.db' AS __test__config__latest_storage_block_size_16kB (STORAGE_VERSION 'latest');

@@ -0,0 +1,35 @@
{
"description": "Run everything with the latest storage on databases with a default block size of 16kB.",
"on_init": "ATTACH '__TEST_DIR__/{BASE_TEST_NAME}block_size.db' AS __test__config__latest_storage_block_size_16kB (BLOCK_SIZE 16384, STORAGE_VERSION 'latest'); SET storage_compatibility_version='latest';",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ATTACH '__TEST_DIR__/{BASE_TEST_NAME}block_size.db'

Should we give the files themselves a very long identifier, to also avoid file conflicts? 😅

@taniabogatsch
Copy link
Contributor

Note that for the configuration with a persistent db, I had to exclude a number of tests that assume the default setting (in-memory db with name 'memory'). A next iteration might be to make that more transparant

Let's remove the persistent DB one, like I already noted in my comment :) we can re-add it while looking at the tests later.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft July 22, 2025 16:18
@Mytherin Mytherin marked this pull request as ready for review July 23, 2025 08:20
@duckdb-draftbot duckdb-draftbot marked this pull request as draft July 23, 2025 14:13
@c-herrewijn c-herrewijn marked this pull request as ready for review July 23, 2025 14:33
@c-herrewijn
Copy link
Member Author

@Mytherin
Can you merge this one?
I just discussed with Tania and Carlo, the errors in NightlyTests are unrelated.

@Mytherin Mytherin merged commit 61cf5c7 into duckdb:v1.3-ossivalis Jul 24, 2025
66 of 70 checks passed
@Mytherin
Copy link
Collaborator

Thanks!

@Mytherin
Copy link
Collaborator

Can we perhaps also do this for block verification? See https://github.com/search?q=repo%3Aduckdb%2Fduckdb%20DUCKDB_BLOCK_VERIFICATION&type=code

github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Jul 24, 2025
github-actions bot added a commit to duckdb/duckdb-r that referenced this pull request Jul 24, 2025
add option 'block_size' to test configs (duckdb/duckdb#18347)
bump httpfs (duckdb/duckdb#18380)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
@c-herrewijn c-herrewijn deleted the block_alloc_size_unittester branch August 4, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants