Repository navigation
Fix 00992_system_parts_race_condition_zookeeper_long: Fix NO_SUCH_COLUMN_IN_TABLE exception during merge after column drop - #96675
Merged
alexey-milovidov merged 3 commits intoFeb 12, 2026
Conversation
When `injectRequiredColumns` needs to inject a minimum-size physical column (because none of the requested columns are physical), it previously used the part's own columns. If a column was dropped from the table after the part was created, that dropped column could be selected as the minimum-size column, causing `StorageSnapshot::getColumnsByNames` to throw `NO_SUCH_COLUMN_IN_TABLE`. The merge task would then retry infinitely, causing the test to hang until timeout. This was a regression from 6d0b4dc which changed from using metadata columns to part columns for finding the minimum-size column. The fix filters part columns to only those also present in the current `StorageSnapshot`, ensuring the injected column is both physically readable from the part and resolvable by the metadata. CI reports: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=aa46ae26c5f10dcfa86bad752fd565b4c38a8165&name_0=MasterCI&name_1=Stateless%20tests%20%28arm_binary%2C%20sequential%29 https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=79be3e6b519049d663b365863d6409ea4deea56e&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_debug%2C%20sequential%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
NO_SUCH_COLUMN_IN_TABLE exception during merge after column drop00992_system_parts_race_condition_zookeeper_long: Fix NO_SUCH_COLUMN_IN_TABLE exception during merge after column drop
…e after column drop This test verifies that `injectRequiredColumns` does not pick a dropped column (still physically present in parts) as the minimum-size column to inject during vertical merge. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…r column drop The previous test did not reliably trigger the bug because: - With only 1-2 rows, compression overhead made all columns equal size, so `getColumnNameWithMinimumCompressedSize` didn't pick the dropped column. - Using `mutations_sync = 2` waited for the DROP mutation to complete, so parts no longer had the dropped column physically. The improved test uses: - 10000 rows per part so `h` (UInt8) is clearly the smallest column. - Failpoint `mt_select_parts_to_mutate_no_free_threads` to prevent background mutation application while allowing `OPTIMIZE TABLE FINAL`. - `alter_sync = 0` so `ALTER DROP COLUMN` returns immediately. - Column `value` added after insertion with constant DEFAULT so it has no physical file, making `have_at_least_one_physical_column` false. Verified: fails with `NO_SUCH_COLUMN_IN_TABLE` on unfixed server, passes on the fixed one. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [e6a25f9] Summary: ❌
|
alexey-milovidov
deleted the
fix-inject-required-columns-dropped-column
branch
February 12, 2026 02:57
Contributor
|
Hi @alexey-milovidov — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
tiandiwonder
added a commit
that referenced
this pull request
Aug 13, 2026
…solvable Supersedes the rename mapping added by the previous commit on this branch. That patch fixed the reported symptom of #103654; this one removes the defect the whole family of failures in this block comes from, and so also closes #103116. `injectRequiredColumns` injects the smallest physical column of a part when none of the requested columns is physically present, only to learn the number of rows. That column has to be both readable from the part and resolvable by the caller, which looks names up in the metadata. The candidate set kept being taken from one side or the other, which guarantees only one of the two properties, and each fix patched the other side: `5c1db5fc661` used metadata columns and could find none with files in the part (`LOGICAL_ERROR`), `6d0b4dc9885` switched to part columns which may be absent from the metadata (`NO_SUCH_COLUMN_IN_TABLE`, #96675), and `1d2e2d1c6b2` intersected the two but compared part names against metadata names, so renamed columns dropped out (#103654), and reverted to part-only names when the intersection came out empty (#103116). Build the candidate set as the pairing instead: walk the metadata columns, map each to its name in the part through `AlterConversions` exactly as `injectRequiredColumnsRecursively` in the same file already does, skip the ones a pending mutation drops because their data is stale, and keep those the part has files for. Both properties then hold by construction. Sizes are looked up under the part's name and the metadata name is what gets injected. When that pairing is empty the two ways of getting there need different answers. If the structure and the pending mutations account for every column the part holds, then each requested column is legitimately absent and the part is read as rows of defaults; no column has to be injected at all, because with adaptive granularity the number of rows comes from the marks, and `getReadTaskColumns` already requires one only when the granularity is not adaptive. If instead the part holds a column that is neither in the structure nor being dropped, that is unexplained data — a part attached after the schema moved on — and reporting defaults for it would hide rows that exist on disk, so the read has to fail. `04011_detach_rename_attach_column` requires exactly that for the renamed variant of it (#79110). Closes: #103654 Closes: #103116 Co-Authored-By: Claude Opus 5 <[email protected]>
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.
When
injectRequiredColumnsneeds to inject a minimum-size physical column (because none of the requested columns are physical), it previously used the part's own columns. If a column was dropped from the table after the part was created, that dropped column could be selected as the minimum-size column, causingStorageSnapshot::getColumnsByNamesto throwNO_SUCH_COLUMN_IN_TABLE. The merge task would then retry infinitely, causing the test to hang until timeout.This was a regression from 6d0b4dc which changed from using metadata columns to part columns for finding the minimum-size column.
The fix filters part columns to only those also present in the current
StorageSnapshot, ensuring the injected column is both physically readable from the part and resolvable by the metadata.CI reports:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=aa46ae26c5f10dcfa86bad752fd565b4c38a8165&name_0=MasterCI&name_1=Stateless%20tests%20%28arm_binary%2C%20sequential%29 https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=79be3e6b519049d663b365863d6409ea4deea56e&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_debug%2C%20sequential%29
Changelog category (leave one):
Version info
26.2.1.609