Skip to content

chore(clickhouse): 移除内置 ClickHouse 插件,改走 clickhouse IPC 驱动扩展 - #436

Merged
feigeCode merged 1 commit into
mainfrom
chore/clickhouse-ipc-driver
Oct 21, 2026
Merged

feigeCode merged 1 commit into
mainfrom
chore/clickhouse-ipc-driver

Conversation

@feigeCode

Copy link
Copy Markdown
Owner

Description

Host-side half of moving ClickHouse onto the extension-driver architecture (same treatment TDengine got when it moved out of the host): the built-in native ClickHouse plugin is removed and DatabaseType::ClickHouse now routes through an IPC external driver with driver_id = "clickhouse".

What changed:

  • Removed the built-in plugin: crates/db/src/clickhouse (plugin.rs / connection.rs / codec.rs, ~3.6k lines), the clickhouse dependency in crates/db and the workspace, and the lib module export.
  • Routed the type to the external driver: DatabaseType::external_driver_id() maps ClickHouse to Some("clickhouse"), so the connection form, open guard, tree menu and IPC protocol all resolve the extension. DbManager::get_plugin now calls resolve_external_plugin(CLICKHOUSE_IPC_DRIVER_ID); the local compatibility path in ipc/plugin.rs returns None for ClickHouse, exactly like TDengine.
  • Legacy connections keep working: required_driver_for_config uses the driver guard, so opening a historical built-in ClickHouse connection prompts to install the extension from the extension market (same policy as DuckDB/TDengine).
  • New-connection entry follows the installation: ClickHouse is only listed in the database category when the clickhouse driver is installed (the category already has other members, so no empty-state install row is added).
  • Connection form from driver.json: navop_runtime no longer asks the built-in plugin for a ui_manifest; the form is declared by the extension's driver.json.
  • Tests rewritten rather than deleted:
    • copy_format: the ClickHouse boolean literal assertion now goes through the external driver's compatible_database_type = ClickHouse and still formats true;
    • table designer DDL sweep excludes types without a native plugin instead of constructing one;
    • the schema-sync FK-ignore case moved to the extension's DDL tests (the host no longer keeps a copy that depends on the removed plugin);
    • added clickhouse_routes_to_external_driver and clickhouse_kind_follows_driver_installation.
  • README / README_CN updated.

Dependency before merge

This PR is only useful once the companion extension is published:

  • repo: navop-extensions, branch feat/clickhouse-ipc-driver, commit 958cd54 (extensions/ipc/clickhouse, HTTP interface, 25 wire methods, driver.json with compatible_database_type=ClickHouse);
  • it is currently published: false and is not yet on the extension market.

Until that extension ships, merging this PR means no ClickHouse support at all: existing ClickHouse connections will show the "install driver" guard. The navop-extensions submodule pointer is intentionally left untouched, matching the TDengine migration, because the driver is delivered through the market rather than bundled.

Break Changes

  • ClickHouse no longer ships inside the host binary; it requires the installable clickhouse IPC driver extension. Legacy built-in ClickHouse connections keep their stored config and are routed to the driver by DatabaseType::ClickHouse.
  • ClickHouse DDL generation / schema-sync SQL now comes from the extension. Host tests that asserted host-side DDL are removed, not silently skipped — the behavior is covered by the extension's ddl tests.
  • Through the HTTP interface the driver has no statement parameter binding: bound parameters return INVALID_PARAMS and affected_rows is reported as 0 rather than fabricated (extension-side detail, listed here so reviewers can see the capability delta).

How to Test

cargo metadata --format-version 1 --locked   # toml/lock consistent
cargo check --workspace --all-targets        # pass
cargo test -p db -p db_view -p main -p navop_runtime

Local results on the rebased branch (base main @ db76dd449):

db:            1320 passed
db_view:        953 passed, 1 ignored
main:           697 passed
navop_runtime:   72 passed (+8 other small targets)

Manual checks:

  1. With the clickhouse driver installed: New Connection → database category shows ClickHouse; the form comes from driver.json; connecting and browsing a database works.
  2. Without the driver installed: the database category does not list ClickHouse, and opening a previously saved built-in ClickHouse connection shows the install prompt.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)

- 删除 crates/db/src/clickhouse 原生插件(plugin/connection/codec),移除 db 的
  clickhouse 依赖与 lib 模块导出,workspace 依赖同步清理
- DatabaseType::ClickHouse 纳入 external_driver_id(-> "clickhouse"),连接表单/
  打开守卫/新建入口/IPC 协议按外部驱动路由;DbManager 复用 resolve_external_plugin,
  ipc/plugin 的本地兼容实现返回 None
- required_driver_for_config 为 ClickHouse 走驱动守卫,未安装时引导从扩展市场安装,
  与 DuckDB/TDengine 同策略,兼容历史内置连接
- 新建入口未安装 clickhouse 驱动时不展示 ClickHouse(数据库类目本就有其他成员,
  不追加空态安装入口);onetcli_runtime 的连接表单改由 driver.json 声明式提供
- 依赖内置插件的测试改写而非静默删除:copy_format 改用 compatible_database_type=
  ClickHouse 的外部驱动断言布尔仍格式化为 true;表设计器 DDL 断言排除无原生插件类型;
  sync_plan 中外键忽略用例的行为已由扩展侧 ddl 单测覆盖
- 更新 README/README_CN 描述;新增 clickhouse_routes_to_external_driver 与
  clickhouse_kind_follows_driver_installation 单测
- cargo check --workspace --all-targets 通过;db 1311、db_view 943、main 674、
  navop_runtime 全部单测通过
@feigeCode
feigeCode merged commit 20a2238 into main Oct 21, 2026
8 checks passed
@feigeCode
feigeCode deleted the chore/clickhouse-ipc-driver branch October 22, 2026 02:34
@feigeCode feigeCode mentioned this pull request Oct 22, 2026
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.

1 participant