Skip to content

fix(mysql): read Doris's real build from @@version_comment - #576

Merged
cevheri merged 1 commit into
mainfrom
fix/mysql-doris-version-comment
Sep 5, 2026
Merged

fix(mysql): read Doris's real build from @@version_comment#576
cevheri merged 1 commit into
mainfrom
fix/mysql-doris-version-comment

Conversation

@kaya-abdullah

Copy link
Copy Markdown
Member

Description

Apache Doris answers VERSION() with a fixed, fictitious MySQL compatibility number (5.7.99) and has no current_version() to fall back to, so the overview showed a vendor-less "MySQL 5.7.99" for every Doris connection. Doris does put its own build string in @@version_comment ("doris version doris-4.1.3-rc02-7126cf65d96"), which getOverview() now reads in the same query as VERSION(), and labelServerVersion() now prefers that string when it matches Doris's shape, showing "Apache Doris 4.1.3-rc02-7126cf65d96" instead.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test addition or update

Related Issue

No linked issue. Found while preparing the Apache Doris vendor-listing docs, and scoped narrowly enough to fix directly rather than file first.

Changes Made

  • src/lib/db/providers/sql/mysql.ts: getOverview()'s existing SELECT VERSION() now also selects @@version_comment in the same query (no new round trip). Added DORIS_VERSION_COMMENT and extended labelServerVersion() to prefer the parsed Doris build string when VERSION() does not already self-identify (matching the existing MariaDB/TiDB/Vitess/OceanBase path) and version_comment matches Doris's "doris version ..." shape.
  • Corrected the caveat text in src/lib/db/compatibility.ts, docs/providers/README.md and docs/providers/mysql.md that described the old, unread @@version_comment behavior as permanent.
  • Added integration tests in tests/integration/db/mysql-provider.test.ts for the Doris label and for a generic version_comment (real MySQL's own) not being mistaken for Doris's, and updated tests/unit/db/compatibility.test.ts to match the corrected caveats.

Testing

  • I have tested this locally
  • I have added/updated tests
  • All existing tests pass

Test Environment

  • LibreDB Studio Version: 0.13.7
  • Browser: N/A (server-side provider change, no UI touched)
  • OS: Linux
  • Node.js/Bun Version: Bun 1.3.10
  • Database Type: Apache Doris, StarRocks, MySQL, MariaDB

Screenshots (if applicable)

None attached, no UI change. Verified by connecting to live containers and reading @@version_comment directly, and through getOverview()'s query; the exact readings are under Additional Notes.

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published (not applicable, no dependent changes)

Additional Notes

Ran bun run format, lint, typecheck, and the full test suite locally. 10531/10532 pass; the one failure (tests/unit/db/sqlite-driver.test.ts, "No such built-in module: node:sqlite") reproduces identically on a clean main checkout with no changes, confirmed with git stash, unrelated to this change. mysql.ts itself shows 100 percent line and function coverage from its own test file in isolation.

Live verification against fresh containers, direct SQL and through the provider:

  • Apache Doris (apache/doris:all-in-one-4.1.3): SELECT VERSION(), @@version_comment returns 5.7.99 / doris version doris-4.1.3-rc02-7126cf65d96; overview now reads Apache Doris 4.1.3-rc02-7126cf65d96.
  • StarRocks (starrocks/allin1-ubuntu:3.3-latest, fresh container, the fork this shares the code path with): version_comment answers its own build, 3.3.22-753696f, which does not match the Doris pattern; overview is unchanged, still MySQL 5.1.0.
  • MySQL (mysql:latest, 26.7.0): version_comment answers MySQL Community Server - GPL, does not match; unchanged.
  • MariaDB (mariadb:12.3, 12.3.2): already self-identifies through VERSION() before version_comment is checked at all; unchanged.

Apache Doris answers VERSION() with a fixed, fictitious MySQL
compatibility number (5.7.99) and has no current_version() to fall
back to, so the overview showed a vendor-less "MySQL 5.7.99" for
every Doris connection. Doris does put its own build string in
@@version_comment ("doris version doris-4.1.3-rc02-7126cf65d96"),
which getOverview() now reads in the same query as VERSION() and
labelServerVersion() now prefers when the version_comment matches
that shape, showing "Apache Doris 4.1.3-rc02-7126cf65d96" instead.

Real MySQL's own version_comment ("MySQL Community Server - GPL")
and MariaDB's ("mariadb.org binary distribution") do not match the
Doris pattern, and MariaDB/TiDB/Vitess/OceanBase already
self-identify through VERSION() before version_comment is even
checked, so none of those change. Verified live against a fresh
apache/doris:all-in-one-4.1.3, a fresh starrocks/allin1-ubuntu:3.3
(the fork this shares a code path with, version_comment answers its
own build number and does not match either), plain MySQL 26.7.0 and
MariaDB 12.3.2.

Updated the caveat text in compatibility.ts, docs/providers/README.md
and docs/providers/mysql.md that described the old, unread behavior
as permanent.
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

sonarqubecloud Bot commented Sep 5, 2026

Copy link
Copy Markdown

@cevheri
cevheri merged commit dbc141f into main Sep 5, 2026
27 checks passed
@cevheri
cevheri deleted the fix/mysql-doris-version-comment branch September 5, 2026 20:56
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