Skip to content

fix(db): 外部驱动增加最低版本门,OceanBase 低于 0.1.12 时引导用户更新 - #260

Merged
feigeCode merged 1 commit into
mainfrom
fix/oceanbase-driver-min-version-249
Sep 20, 2026
Merged

feigeCode merged 1 commit into
mainfrom
fix/oceanbase-driver-min-version-249

Conversation

@feigeCode

Copy link
Copy Markdown
Owner

Closes #249

Description

The host only checked whether an external database driver was installed, never which version. OceanBase drivers before 0.1.12 encoded u64 cells as decimal text, while the host struct field is u64, so reading a table with unsigned columns failed with invalid external driver response: invalid type: string "4", expected u64. The driver contract is already fixed on the driver side (navop-extensions#9, shipped as oceanbase 0.1.12), but installed drivers are never updated automatically and the host showed no hint, so users on 0.1.10/0.1.11 kept hitting an error they cannot act on.

This PR makes the host version-aware for external drivers:

  • DriverRequirement::Required now carries minimum_version: Option<String>.
  • required_external_driver declares a minimum version per driver id (currently oceanbase -> 0.1.12); undeclared drivers keep the old no-minimum behavior.
  • The connection guard now uses driver_version_meets_minimum instead of a plain "is installed" check, so an installed-but-too-old driver also goes through the install/update flow, with the existing prompt text (最低版本 0.1.12).
  • The install flow reuses find_database_driver_entry_for_requirement, which refuses a marketplace entry below the required version.

Serialization and the driver contract are unchanged; this only decides whether a connection is opened or the user is asked to update the driver first.

Screenshot

Before After
OceanBase connection with driver < 0.1.12 opens, then table read fails with a type error Prompt 需要安装或更新驱动 …(最低版本 0.1.12), one click installs/updates from the marketplace

How to Test

  1. cargo test -p extension-runtime — 215 passed, 1 pre-existing failure (extension_runtime_wasm_contract_tests::db_tree_action_runs_registered_wasm_component), which also fails on a clean main checkout without this change.
  2. New test oceanbase_external_driver_requires_a_minimum_version asserts required_driver_for_config returns minimum_version: Some("0.1.12") for oceanbase, and that driver_version_meets_minimum rejects 0.1.11 while accepting 0.1.12 / 0.1.13.
  3. Existing tests updated for the new field: duckdb_requires_duckdb_marketplace_driver, external_database_requires_its_driver_id (both minimum_version: None).
  4. cargo clippy -p extension-runtime --all-targets — no warnings in the touched files.

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)

宿主此前只判断外部驱动是否已安装,不校验版本:OceanBase 0.1.12 之前的驱动对
无符号列发十进制文本,宿主反序列化会直接判类型不匹配
(invalid type: string "4", expected u64),整表读取失败;而旧驱动既不会被自动
更新,宿主也不会提示,用户只能看到一句读不懂的报错。

- DriverRequirement::Required 增加 minimum_version
- required_external_driver 按驱动 id 声明最低版本(当前: oceanbase -> 0.1.12)
- 连接守卫改为版本感知:已安装但低于最低版本时同样走安装/更新引导,
  提示文案带"(最低版本 0.1.12)"
- 安装流程沿用既有 find_database_driver_entry_for_requirement 校验市场版本

Refs #249
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.

[Bug]: MySQL 返回字符串 "4",Rust 侧结构体定义为 u64

1 participant