Repository navigation
Conversation
Hakaou
force-pushed
the
insert-data-expected-rows
branch
2 times, most recently
from
October 18, 2026 13:17
4265ed3 to
b460f49
Compare
The expectation branched on which block was being read and indexed TEST_DATA with the running row number. When the server returns the eight rows in one block, that reads past TEST_DATA (UBSan: index 4 out of bounds, client_ut.cpp:625-627). The reads happened to return the expected values, which nothing guarantees. The select had no ORDER BY either. When the server keeps the two inserted blocks separate, it may return the second one first. The select now orders by id, and every received row is compared against both datasets sorted by id.
Hakaou
force-pushed
the
insert-data-expected-rows
branch
from
October 18, 2026 14:34
b460f49 to
b90972e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Noticed while running the client suite under UBSan for #575.
InsertDatainserts two blocks of four rows, then checks the selected rows with a branch on which block is being read, indexingTEST_DATAwith the running row number. When the server returns the eight rows in a single block, the first branch runs for all eight rows and readsTEST_DATA[4..7], past the array:The reads happened to return the expected values, which nothing guarantees.
The select also has no
ORDER BY. With insert squashing disabled (min_insert_block_size_rows = 0,min_insert_block_size_bytes = 0) andmax_block_size = 1, a 25.12.13.2 server keeps the two inserted blocks separate and sometimes returns2, 4, 6, 8first: 3 of 600 runs of the current test failed that way locally. 26.11 stores them as one block, so it did not reproduce there.To reproduce on 25.12: add the three settings to the
defaultprofile ofci/docker-compose/users.xml, start the server with it, then run./clickhouse-cpp-ut --gtest_filter='*InsertData*' --gtest_repeat=300onmaster.Change: one
Rowstruct, both datasets as vectors, the select orders byid, the expectation is both datasets sorted byid, and every received row is compared against it withASSERT_LT(row, expected_rows.size())instead of the branch. Block boundaries and block order no longer matter.Checked locally (macOS arm64) against 25.12, 26.3 and 26.11: the test passes under AddressSanitizer and UBSan with
halt_on_error=1, 600 runs in a row with the settings above on 25.12, and the wholeClientCasesuite stays green.