mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
The point-lookup queries (#4-#7) in apply_patch_parts_join produced 18-30% test noise because the four UPDATE statements that build the patch parts ran with default parallelism. Parallel threads racing into the patch builder produce different patch-part split boundaries on every run, which changes how many patch granules a point lookup at id=5000000 ends up reading. Per-server timing then depends on the random split, not on the code being measured. Force INSERT and UPDATE to use a single thread plus a block size large enough to fit each whole patch, so the patch-part layout is the same on every run. Locally verified deterministic over 20 cycles. Setup time goes from ~4.2s to ~6.3s. Scan queries (#0-#3) still detect patch-apply-path regressions as before. Refs #100759.
58 lines
2.8 KiB
XML
58 lines
2.8 KiB
XML
<test>
|
|
<settings>
|
|
<allow_experimental_lightweight_update>1</allow_experimental_lightweight_update>
|
|
</settings>
|
|
|
|
<create_query>
|
|
CREATE TABLE test_lwu_join
|
|
(
|
|
id UInt64,
|
|
uint_1p UInt64,
|
|
uint_10p UInt64,
|
|
str_1p String,
|
|
str_10p String,
|
|
)
|
|
ENGINE = MergeTree ORDER BY id
|
|
SETTINGS apply_patches_on_merge = 0, enable_block_number_column = 1, enable_block_offset_column = 1;
|
|
</create_query>
|
|
|
|
<fill_query>SYSTEM STOP MERGES test_lwu_join</fill_query>
|
|
|
|
<!-- Single-threaded INSERT and UPDATE with a block-size that fits each
|
|
whole patch keep the patch part layout deterministic across runs.
|
|
Without this, parallel threads race into the patch builder, the
|
|
split boundary varies, and point-lookup queries below read a
|
|
varying number of patch granules, producing 18-30% noise on
|
|
queries #4 to #7. -->
|
|
<fill_query>INSERT INTO test_lwu_join
|
|
SELECT
|
|
number,
|
|
rand(),
|
|
rand(),
|
|
randomPrintableASCII(8),
|
|
randomPrintableASCII(8),
|
|
FROM numbers_mt(20000000) SETTINGS max_insert_threads=1
|
|
</fill_query>
|
|
|
|
<fill_query>UPDATE test_lwu_join SET uint_1p = rand() WHERE id % 100 = 0 SETTINGS max_threads=1, max_insert_block_size=3000000, min_insert_block_size_rows=3000000</fill_query>
|
|
<fill_query>UPDATE test_lwu_join SET uint_10p = rand() WHERE id % 10 = 0 SETTINGS max_threads=1, max_insert_block_size=3000000, min_insert_block_size_rows=3000000</fill_query>
|
|
|
|
<fill_query>UPDATE test_lwu_join SET str_1p = randomPrintableASCII(8) WHERE id % 100 = 0 SETTINGS max_threads=1, max_insert_block_size=3000000, min_insert_block_size_rows=3000000</fill_query>
|
|
<fill_query>UPDATE test_lwu_join SET str_10p = randomPrintableASCII(8) WHERE id % 10 = 0 SETTINGS max_threads=1, max_insert_block_size=3000000, min_insert_block_size_rows=3000000</fill_query>
|
|
|
|
<fill_query>SYSTEM START MERGES test_lwu_join</fill_query>
|
|
<fill_query>OPTIMIZE TABLE test_lwu_join PARTITION ID 'all' FINAL</fill_query>
|
|
|
|
<query>SELECT count() FROM test_lwu_join WHERE NOT ignore(uint_1p)</query>
|
|
<query>SELECT count() FROM test_lwu_join WHERE NOT ignore(uint_10p)</query>
|
|
<query>SELECT count() FROM test_lwu_join WHERE NOT ignore(str_1p)</query>
|
|
<query>SELECT count() FROM test_lwu_join WHERE NOT ignore(str_10p)</query>
|
|
|
|
<query>SELECT uint_1p FROM test_lwu_join WHERE id = 5000000</query>
|
|
<query>SELECT uint_10p FROM test_lwu_join WHERE id = 5000000</query>
|
|
<query>SELECT str_1p FROM test_lwu_join WHERE id = 5000000</query>
|
|
<query>SELECT str_10p FROM test_lwu_join WHERE id = 5000000</query>
|
|
|
|
<drop_query>DROP TABLE IF EXISTS test_lwu_join</drop_query>
|
|
</test>
|