Repository navigation
Add SYSTEM UNLOAD DICTIONARY / DICTIONARIES commands - #109639
Conversation
|
Workflow [PR], commit [602f590] Summary: ✅
AI ReviewSummaryThis PR adds Findings❌ Blockers
Final VerdictNeeds changes before merge. |
Adding CLEAR_ENCRYPTION_HEADERS_CACHE (SYSTEM DROP ENCRYPTION HEADERS CACHE) pushed the last enumerator RESET_DDL_WORKER from ordinal 127 to 128, outside magic_enum's default reflection range [-128, 127]. ParserSystemQuery matches SYSTEM keywords via magic_enum::enum_values, so RESET_DDL_WORKER silently dropped out of the value list: SYSTEM RESET DDL WORKER stopped parsing and its access check was never reached, making 04401_system_reset_ddl_worker_access fail with both the unprivileged and on-cluster queries reported as NOT denied. Specialize magic_enum::customize::enum_range<ASTSystemQuery::Type> to cover every value (min = 0, max = 512), matching the fix used by other recent SYSTEM-command additions (e.g. #109639).
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 86/92 (93.48%) · Uncovered code |
|
@groeneai the tag |
|
@Manerone acknowledged. I'll open a new PR removing the |
|
@Manerone I looked into removing Why it flakes without the tag. The test runs Two failure modes I reproduced locally (debug build, 12 concurrent copies):
Dropping only the racy Convention. Every other stateless test that issues a global dictionary command is Options, your call:
I have not pushed anything. Let me know which you prefer and I will open the PR. |
|
@groeneai split the test file into two, keep the SYSTEM UNLOAD DICTIONARIES in their own test file with the no-parallel tag, and move the other parts of the test into their own test file where we can allow parallel tests. Create a new PR for this and ping me |
|
@Manerone acknowledged. I'll split 03814_system_unload_dictionary.sql into two tests: one keeping the server-global |
Manerone asked to turn the section-header comments into SELECT queries so the reference file reads cleanly; apply that to both split tests. The clickhouse-gh bot noted the split dropped the mixed SYSTEM UNLOAD DICTIONARIES -> SYSTEM UNLOAD DICTIONARY assertion (verifying a dictionary already unloaded server-wide is still idempotently unloadable via the singular path). Restore that assertion at the end of the second global-unload block in the no-parallel test. Related: ClickHouse#109639 Co-Authored-By: Claude Opus 4.8 <[email protected]>
…el tests SYSTEM UNLOAD DICTIONARIES (plural) is server-global: it unloads dictionaries owned by other concurrently-running tests, which is why 03814_system_unload_dictionary required the no-parallel tag. The singular SYSTEM UNLOAD DICTIONARY name is database-scoped and parallel-safe. Move the two server-global SYSTEM UNLOAD DICTIONARIES cases into a new 03814_system_unload_dictionaries test that keeps no-parallel, and drop no-parallel from 03814_system_unload_dictionary, which now exercises only the database-scoped singular commands and runs in parallel. All existing coverage is preserved: the parallel test keeps its LOADED/NOT_LOADED status transitions because, once the global command is split out, no parallel-batch test issues a global unload. Related: ClickHouse#109639 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Adding CLEAR_ENCRYPTION_HEADERS_CACHE (SYSTEM DROP ENCRYPTION HEADERS CACHE) pushed the last enumerator RESET_DDL_WORKER from ordinal 127 to 128, outside magic_enum's default reflection range [-128, 127]. ParserSystemQuery matches SYSTEM keywords via magic_enum::enum_values, so RESET_DDL_WORKER silently dropped out of the value list: SYSTEM RESET DDL WORKER stopped parsing and its access check was never reached, making 04401_system_reset_ddl_worker_access fail with both the unprivileged and on-cluster queries reported as NOT denied. Specialize magic_enum::customize::enum_range<ASTSystemQuery::Type> to cover every value (min = 0, max = 512), matching the fix used by other recent SYSTEM-command additions (e.g. ClickHouse#109639).
Adding CLEAR_ENCRYPTION_HEADERS_CACHE (SYSTEM DROP ENCRYPTION HEADERS CACHE) pushed the last enumerator RESET_DDL_WORKER from ordinal 127 to 128, outside magic_enum's default reflection range [-128, 127]. ParserSystemQuery matches SYSTEM keywords via magic_enum::enum_values, so RESET_DDL_WORKER silently dropped out of the value list: SYSTEM RESET DDL WORKER stopped parsing and its access check was never reached, making 04401_system_reset_ddl_worker_access fail with both the unprivileged and on-cluster queries reported as NOT denied. Specialize magic_enum::customize::enum_range<ASTSystemQuery::Type> to cover every value (min = 0, max = 512), matching the fix used by other recent SYSTEM-command additions (e.g. ClickHouse#109639).
Add SYSTEM UNLOAD DICTIONARY / DICTIONARIES commands
Continuation of PR #96064, because I do not have rights to push directly in the related fork.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add
SYSTEM UNLOAD DICTIONARYandSYSTEM UNLOAD DICTIONARIEScommands to release dictionary memory without dropping the dictionary definition. Dictionaries will be reloaded lazily on next access.Documentation entry for user-facing changes
New SQL commands:
SYSTEM UNLOAD DICTIONARY [db.]name— unloads a specific dictionary from memory, releasing its data. The dictionary will be reloaded automatically on next query that accesses it.SYSTEM UNLOAD DICTIONARIES— unloads all loaded dictionaries.Motivation: When dictionaries consume significant memory but are only needed occasionally, users can free memory without dropping and recreating the dictionary. This was previously not possible — the only options were
DROP DICTIONARY(loses definition) or waiting for server restart.Reuses
SYSTEM_RELOAD_DICTIONARYaccess rights, so users with reload permissions can also unload.Example:
Closes #93776