Skip to content

Document missing SYSTEM cache statements - #108546

Merged
alexey-milovidov merged 2 commits into
masterfrom
doc-848-document-system-drop-primary-index-cache
Jul 1, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
doc-848-document-system-drop-primary-index-cache

Conversation

@dhtclk

@dhtclk dhtclk commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

What

DOC-848 reported that SYSTEM DROP PRIMARY INDEX CACHE was missing from the system statements docs. While adding it, I swept the SYSTEM command enum against the docs and found 13 undocumented cache commands in total, so this PR documents the whole set.

Added sections:

  • Drops: PRIMARY INDEX CACHE, INDEX MARK CACHE, INDEX UNCOMPRESSED CACHE, MMAP CACHE, PAGE CACHE, VECTOR SIMILARITY INDEX CACHE, CONNECTIONS CACHE, S3 CLIENT CACHE
  • Prewarm: PREWARM MARK CACHE, PREWARM PRIMARY INDEX CACHE (with [ON CLUSTER] db.table syntax)
  • Other shapes: DISK METADATA CACHE (targets a disk), SYNC FILESYSTEM CACHE (returns a result set), DROP DISTRIBUTED CACHE (ClickHouse Cloud, with a Cloud-only note)

Also fixes the existing TEXT INDEX CACHES section: it referred to a "dictionary" cache, but the code clears a tokens cache (clearTextIndexTokensCache).

How it was verified

  • Command names, verbs (CLEAR/DROP synonyms), and syntax from src/Parsers/ParserSystemQuery.cpp.
  • Behavior from the handlers in src/Interpreters/InterpreterSystemQuery.cpp.

One caveat: DROP DISTRIBUTED CACHE has no open-source execution handler (it's a ClickHouse Cloud feature), so it's documented from its parser syntax + Cloud-only status with a conservative description — worth a Cloud-team sanity check on the wording.

Changelog category (leave one):

  • Documentation (changelog entry is not required)

Version info

  • Merged into: 26.7.1.314 (included in 26.7 and later)

Adds the SYSTEM cache commands that were missing from the system
statements docs:

- DROP PRIMARY INDEX CACHE (DOC-848), INDEX MARK CACHE, INDEX
  UNCOMPRESSED CACHE, MMAP CACHE, PAGE CACHE, VECTOR SIMILARITY INDEX
  CACHE, CONNECTIONS CACHE, S3 CLIENT CACHE
- PREWARM MARK CACHE and PREWARM PRIMARY INDEX CACHE
- DISK METADATA CACHE, SYNC FILESYSTEM CACHE, and DROP DISTRIBUTED CACHE
  (ClickHouse Cloud)

Also fixes the TEXT INDEX CACHES section, which referred to a
"dictionary" cache; the code clears a "tokens" cache.

Commands, verbs and syntax were taken from ParserSystemQuery.cpp and
InterpreterSystemQuery.cpp.

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

clickhouse-gh Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c519d9a]

Summary: ✅


AI Review

Summary

This PR fills missing SYSTEM cache-statement documentation and corrects the text-index cache naming from dictionary to tokens. The previous inline findings are addressed in the current docs, but the newly documented primary-index prewarm ON CLUSTER form exposes an access-control mismatch in the cluster execution path, so I am requesting changes.

Missing context / blind spots
  • ⚠️ The open-source checkout has parser and AST support for SYSTEM DROP DISTRIBUTED CACHE, but not the Cloud execution handler; Cloud-team confirmation of the wording would close this gap.
Findings

⚠️ Majors

  • [docs/en/sql-reference/statements/system.md:172] The documented SYSTEM PREWARM PRIMARY INDEX CACHE ... ON CLUSTER form promises the same operation as local primary-index prewarm, but InterpreterSystemQuery::getRequiredAccessForDDLOnCluster records AccessType::SYSTEM_PREWARM_MARK_CACHE for Type::PREWARM_PRIMARY_INDEX_CACHE, while local execution checks AccessType::SYSTEM_PREWARM_PRIMARY_INDEX_CACHE. A user granted only the primary-index prewarm privilege can run the local command but is denied for the documented cluster form unless they also have the mark-cache prewarm privilege.
  • Suggested fix: change the DDL-on-cluster access element for PREWARM_PRIMARY_INDEX_CACHE to SYSTEM_PREWARM_PRIMARY_INDEX_CACHE, or remove ON CLUSTER from this syntax if it is intentionally unsupported.
Tests
  • ⚠️ Add focused access coverage for the documented SYSTEM PREWARM PRIMARY INDEX CACHE ... ON CLUSTER form, for example a user with SYSTEM PREWARM PRIMARY INDEX CACHE but not SYSTEM PREWARM MARK CACHE.
Final Verdict

Status: ⚠️ Request changes

Minimum required action: fix or remove the documented ON CLUSTER form for SYSTEM PREWARM PRIMARY INDEX CACHE, and cover the privilege mapping with a focused test.

@clickhouse-gh clickhouse-gh Bot added the pr-documentation Documentation PRs for the specific code PR label Jun 25, 2026
@dhtclk
dhtclk requested a review from Blargian June 25, 2026 20:33
…name

Address review feedback:
- SYSTEM PREWARM MARK CACHE also loads secondary-index marks into the
  index mark cache.
- SYSTEM SYNC FILESYSTEM CACHE takes the cache name as a string literal,
  so document it quoted.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
```

## SYSTEM CLEAR|DROP DISK METADATA CACHE {#drop-disk-metadata-cache}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The documented ON CLUSTER form does not currently honor the privilege for this command. Local execution of SYSTEM PREWARM PRIMARY INDEX CACHE calls prewarmPrimaryIndexCache and checks AccessType::SYSTEM_PREWARM_PRIMARY_INDEX_CACHE, but the DDL-on-cluster path in InterpreterSystemQuery::getRequiredAccessForDDLOnCluster still records AccessType::SYSTEM_PREWARM_MARK_CACHE for Type::PREWARM_PRIMARY_INDEX_CACHE. A user granted only the documented primary-index prewarm privilege will therefore be denied before the query is sent to the cluster, unless they also have the separate mark-cache prewarm privilege. Please switch that required access element to SYSTEM_PREWARM_PRIMARY_INDEX_CACHE and add a small access test for the ON CLUSTER form, or drop ON CLUSTER from the docs if it is intentionally unsupported.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To confirm: it's a pre-existing core access-control bug, not introduced by this PR. The Type::PREWARM_PRIMARY_INDEX_CACHE case in getRequiredAccessForDDLOnCluster() (L2736) records SYSTEM_PREWARM_MARK_CACHE, while local execution (L2444) checks SYSTEM_PREWARM_PRIMARY_INDEX_CACHE.

The documented ON CLUSTER syntax itself is correct, intended form; only the privilege mapping on the cluster path is wrong. Since this is a code fix in access control (plus a focused test) and outside the scope of a docs-only PR, I've filed it separately as #108956 for the access-control owner. Keeping this PR docs-only.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jun 30, 2026
@alexey-milovidov alexey-milovidov self-assigned this Jun 30, 2026
Merged via the queue into master with commit 300b98a Jul 1, 2026
174 checks passed
@alexey-milovidov
alexey-milovidov deleted the doc-848-document-system-drop-primary-index-cache branch July 1, 2026 00:26
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 1, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…-system-drop-primary-index-cache

Document missing SYSTEM cache statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-documentation Documentation PRs for the specific code PR 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.

3 participants