Remove cluster check for entity type#9713
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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".
| // 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 = ?` |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
IMO it is fine to exclude this scenario. The callers of renameEntity are :
- When staging tables are renamed. The migration from single node to cluster can't happen in that case.
- 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.
2c48c84 to
24845d8
Compare
* use view instead of directly querying system.tables in clusterAllReplicas * tests fixes * review * nit * build fix
Checklist: