Repository navigation
Check the temporary table limits on RESTORE - #124587
Conversation
`RESTORE TEMPORARY TABLE` bypassed `max_temporary_table_memory_usage` for `Memory` tables (`StorageMemory::restoreDataImpl` called `setData` without a check) and `max_temporary_table_size_bytes_compressed` / `max_temporary_table_size_bytes_uncompressed` for `MergeTree` tables (`StorageMergeTree::attachRestoredParts` committed the parts without a check). Both are now checked with the settings of the `RESTORE` query; a `MergeTree` restore is checked for the whole batch before the first part is committed, so it is rejected as a whole. Addresses the review comments on #122165 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [00001a8] Summary: ✅
AI ReviewSummaryThis PR threads the Final Verdict✅ No blockers or majors found in the current revision; this looks ready to merge. LLVM Coverage ReportMeasured on commit 00001a8.
Changed lines: Changed C/C++ lines covered: 26/26 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units245 translation units recompiled, 2637 s compile time in total, 245 of them have a recent master baseline. |
|
📊 Cloud Performance Report
This PR checks temporary-table size and memory limits during RESTORE, in StorageMemory::restoreDataImpl and StorageMergeTree::attachRestoredParts, and passes the RESTORE query's settings down to those checks. None of this code runs in the clickbench or tpch_adapted_1_official SELECT queries, so it should have no effect on these benchmarks. Two queries were flagged, and the automatic checks already held both back: clickbench Q31 (-19.1%) falls inside master's normal range, and clickbench Q34 (-9.3%) is not_sure because master's own timings for it are unstable after a shift in early October. Both look like normal baseline movement rather than an effect of this PR, and nothing here needs action. clickbenchFlagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
alexey-milovidov
left a comment
There was a problem hiding this comment.
This is excessive, but okay.
|
Why do we even backup temporary tables? This is to @vitlibar, I've already asked this question before. It is just a mis-feature. |
Conflict in StorageMergeTree::attachRestoredParts: master added a check of the temporary table size limits before the parts are committed (ClickHouse#124587). Keep that check first and declare reset_level after it; the check reads only part sizes, so the level and mutation reset do not affect it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow-up to #122165, from two of its review comments that were still unresolved when it was merged.
RESTORE TEMPORARY TABLEgot around the new limits:Memorytables,StorageMemory::restoreDataImplcalledsetDatawithout checkingmax_temporary_table_memory_usage;MergeTreetables,StorageMergeTree::attachRestoredPartscommitted the restored parts without checkingmax_temporary_table_size_bytes_compressed/max_temporary_table_size_bytes_uncompressed.Both are now checked with the settings of the
RESTOREquery, asINSERTandALTERalready do. AMergeTreerestore is checked for the whole batch before the first part is committed, so it is rejected as a whole, asATTACH PARTITIONis. To make this possible,attachRestoredPartsnow receives the restore context.Related: #122165
Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124587]
Version info
26.10.1.1921-master(included in26.10and later)