Skip to content

Remove the stale TODO about unloading tables in reverse topological order - #114917

Merged
alexey-milovidov merged 2 commits into
masterfrom
drop-database-order-todo-comment
Aug 15, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
drop-database-order-todo-comment

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

DatabaseCatalog::checkTableCanBeRemovedOrRenamedUnlocked skips dependent tables from the same database when the removal comes from DROP DATABASE, and carried a TODO asking for the tables to be unloaded in reverse topological order instead.

That ordering exists since #97057: InterpreterDropQuery::executeToDatabaseImpl sorts the tables of a DROP DATABASE in reverse loading dependency order, so a dependent is always dropped before the table it depends on. The skip itself is still required, since the dependency graph is consulted per table while the database is being emptied, so only the obsolete TODO is replaced by a pointer to the code that maintains the invariant.

Comment-only change.

Related: #87369
Related: #102506

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Version info

  • Merged into: 26.8.1.1460 (included in 26.8 and later)

…rder

`DatabaseCatalog::checkTableCanBeRemovedOrRenamedUnlocked` skips dependent
tables from the same database when the removal comes from `DROP DATABASE`,
and carried a TODO asking for tables to be unloaded in reverse topological
order instead.

That ordering exists since #97057:
`InterpreterDropQuery::executeToDatabaseImpl` sorts the tables of a
`DROP DATABASE` in reverse loading dependency order, so a dependent is always
dropped before the table it depends on. The skip here is still required - the
dependency graph is consulted per table while the database is being emptied -
so only the obsolete TODO is replaced by a pointer to the code that maintains
the invariant.

Related: #87369
Related: #102506

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1298e80]

Summary: ✅


AI Review

Summary

This PR replaces a stale TODO in DatabaseCatalog::checkTableCanBeRemovedOrRenamedUnlocked with a narrower comment: DROP DATABASE relies on InterpreterDropQuery::executeToDatabaseImpl to process loading_dependencies in reverse order, while referential-only dependencies still need separate handling. That matches the current implementation, including the previously raised referential-dependency gap now preserved as an explicit TODO, so I do not have actionable review findings.

Final Verdict

✅ No new findings.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.70% 86.80% +0.10%
Functions 92.00% 92.00% +0.00%
Branches 79.10% 79.20% +0.10%

Changed lines: Changed C/C++ lines covered: 2/3 (66.67%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 15, 2026
Comment thread src/Interpreters/DatabaseCatalog.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 1298e809b with master bb78f696b (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 693.25 MiB 690.24 MiB -3.02 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

7 translation units recompiled, 19 s compile time in total, 7 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 15, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 15, 2026
Merged via the queue into master with commit 83564fa Aug 15, 2026
357 of 358 checks passed
@alexey-milovidov
alexey-milovidov deleted the drop-database-order-todo-comment branch August 15, 2026 14:34
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 15, 2026
alexey-milovidov added a commit to BoloniniD/ClickHouse that referenced this pull request Aug 16, 2026
`InterpreterDropQuery::executeToDatabaseImpl` sorted the tables of a
database being dropped in reverse topological order of loading
dependencies only (see ClickHouse#97057). Now referential dependencies are taken
into account as well, so a dependent is always dropped before the
tables it depends on, and if the server crashes mid-drop, the remaining
tables keep their dependencies intact.

Implements the TODO from ClickHouse#114917

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants