Skip to content

Remove cluster check for entity type#9713

Merged
k-anshul merged 5 commits into
mainfrom
remove_entity_type_check
Jul 21, 2026
Merged

Remove cluster check for entity type#9713
k-anshul merged 5 commits into
mainfrom
remove_entity_type_check

Conversation

@k-anshul

@k-anshul k-anshul commented Jul 20, 2026

Copy link
Copy Markdown
Member

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@k-anshul k-anshul self-assigned this Jul 20, 2026
@k-anshul
k-anshul requested a review from pjain1 July 20, 2026 10:04
@k-anshul

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b1c5b3b88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +484 to +488
// A local system.tables lookup suffices even when a cluster is configured:
// all DDL in cluster mode runs ON CLUSTER, so the entity always exists on the connected node.
q := `SELECT multiIf(engine IN ('MaterializedView', 'View'), 'VIEW', engine = 'Dictionary', 'DICTIONARY', 'TABLE') AS type
FROM system.tables
WHERE database = coalesce(?, currentDatabase()) AND name = ?`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve local handling for pre-cluster tables

When cluster mode is enabled for an existing deployment, tables created before that configuration can exist only under their original name and have no <name>_local table. This lookup now discards the previous per-entity cluster determination, so renameEntity always follows the distributed-table path and attempts to rename <old>_local on every cluster node (see crud.go:300-338), causing normal model rebuild/rename operations to fail for those existing tables. The table-drop comment already identifies this supported migration scenario; retain per-entity detection or handle legacy local tables separately.

Useful? React with 👍 / 👎.

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.

IMO it is fine to exclude this scenario. The callers of renameEntity are :

  1. When staging tables are renamed. The migration from single node to cluster can't happen in that case.
  2. When models are renamed. Again a very edge case where model is renamed and migration from single node to cluster is also done.

For migration it is recommended to rebuild full models.

Comment thread runtime/drivers/clickhouse/crud.go
@k-anshul k-anshul changed the title use view instead of directly querying system.tables in clusterAllReplicas Remove cluster check for entity type plus use view for billing table check Jul 20, 2026
Comment thread runtime/drivers/clickhouse/clickhouse.go

@pjain1 pjain1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approved with some comments

@k-anshul k-anshul changed the title Remove cluster check for entity type plus use view for billing table check Remove cluster check for entity type Jul 20, 2026
@k-anshul
k-anshul force-pushed the remove_entity_type_check branch from 2c48c84 to 24845d8 Compare July 20, 2026 13:01
@k-anshul
k-anshul merged commit 0e66052 into main Jul 21, 2026
8 of 10 checks passed
@k-anshul
k-anshul deleted the remove_entity_type_check branch July 21, 2026 04:20
k-anshul added a commit that referenced this pull request Jul 21, 2026
* use view instead of directly querying system.tables in clusterAllReplicas

* tests fixes

* review

* nit

* build fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants