Repository navigation
Revert "Fix NO_SUCH_COLUMN_IN_TABLE naming a column absent from the table when a part's columns were all renamed or all dropped" - #119429
Conversation
…able when a part's columns were all renamed or all dropped"
|
Workflow [PR], commit [d9bf6a0] AI ReviewSummaryThis PR reverts the MergeTree read-path changes from Findings❌ Blockers
Final Verdict❌ Changes requested. As written, the revert trades one set of regressions for two older MergeTree read-path correctness bugs, including silent wrong results. |
| * Used in case when no column is needed or files are missing, but at least you need to know number of rows. | ||
| * Adds to the columns. | ||
| */ | ||
| if (!have_at_least_one_physical_column) |
There was a problem hiding this comment.
This brings back the old "inject one physical column just to learn the row count" fallback, but the surrounding read path no longer needs it. loadColumnsChecksumsIndexes now fixes constant granularity from rows_count, MergeTreeReaderIndex::readRows clamps by getRowCount(), and ReadResult::adjustLastGranule() explicitly treats num_read_rows == 0 as already accurate.
With that in place, reintroducing the injection reopens the stale-part bug the deleted 04870_inject_column_no_common_column_with_metadata.sh was covering. A part re-attached after ADD COLUMN b, DROP COLUMN a that still holds a,k now injects k from the metadata intersection and returns rows of default b, silently hiding the on-disk a values; if the part shares no column with metadata, the available_columns = part_columns fallback injects a raw part name and later throws NO_SUCH_COLUMN_IN_TABLE on a legitimate read/merge.
| auto subcolumn_name = required_column.getSubcolumnName(); | ||
|
|
||
| if (alter_conversions->isColumnRenamed(name_in_storage, [&](const auto & name) { return part_columns.has(name); })) | ||
| if (alter_conversions->isColumnRenamed(name_in_storage)) |
There was a problem hiding this comment.
This unconditional back-mapping reintroduces the pending-rename read bug for merged parts. OPTIMIZE ... FINAL writes the merged part under the current column names, but the part keeps the source data_version, so alter_conversions still reports the rename as pending. After this change a request for c is always rewritten to a; on the merged part part_columns only has c, so getColumnInPart() treats the column as missing and fillMissingColumns() synthesizes defaults instead of reading the intact data.
The previous isColumnRenamed(new_name, part_has_column) helper was doing the needed distinction here: only map through the old name when the part actually still stores the old file name, while still handling same-statement name reuse like RENAME A TO C, RENAME B TO A.
Include the upstream row-count repairs needed by the completed CI runs. Resolve the connection conflict by retaining profile-setting preparation and using the shared network compression codec selector from master. Preserve the trace subscription lifecycle, distributed forwarding and protocol negotiation while retaining the upstream shutdown, leaf-timeout and preauthentication changes. Related: ClickHouse#119429 Related: ClickHouse#119400 Related: ClickHouse#117830 (comment) Co-Authored-By: Codex CLI <[email protected]>
Reverts #114562
Broke CI and multiple bugs reported
Workflow [PR]
Sync PR [sync-upstream/pr/119429]
Version info
26.9.1.1193(included in26.9and later)