Skip to content

build(plugin-mysql): vendor the MariaDB headers from the version the build pins - #2451

Merged
datlechin merged 1 commit into
mainfrom
build/mariadb-header-parity
Aug 26, 2026
Merged

build(plugin-mysql): vendor the MariaDB headers from the version the build pins#2451
datlechin merged 1 commit into
mainfrom
build/mariadb-header-parity

Conversation

@datlechin

Copy link
Copy Markdown
Member

The vendored MariaDB Connector/C headers and the static library we ship are different versions, and nothing keeps them together.

  • Plugins/MySQLDriverPlugin/CMariaDB/include/mariadb_version.h declares MARIADB_PACKAGE_VERSION "3.4.8".
  • Libs/libmariadb_arm64.a answers mysql_get_client_info() with 3.4.4, measured by a probe compiled against it.
  • scripts/build-mariadb.sh pins MARIADB_VERSION="3.4.4" and builds exactly that.

So the binary is right and the headers are the wrong artifact. Their own provenance says where they came from: the vendored file carries MARIADB_PLUGINDIR "/opt/homebrew/Cellar/mariadb-connector-c/3.4.8_1/lib/mariadb/plugin". They were copied out of a Homebrew keg rather than out of the source the build script downloads.

What the skew actually contains

Diffed every vendored header against the pinned 3.4.4 source. Five differ, and two of those carry declarations the shipped binary does not export:

Header Difference
errmsg.h adds CR_ERR_MISSING_ERROR_INFO 5026 and moves CR_MARIADB_LAST_ERROR onto it, so the client-error boundary sits one past what the linked library can produce
mariadb_com.h declares ma_net_write_buff and the UDF_ARGS / UDF_INIT structs
ma_tls.h declares ma_is_ip_address
mariadb_version.h the version macros and the Homebrew plugin directory
ma_pvio.h, mysql.h a typo fix and two comment edits

Checked the whole surface rather than just those: of 236 function declarations across the headers, exactly two are absent from libmariadb_arm64.a, mariadb_dyncol_prepare_decimal and mariadb_load_defaults. Neither is referenced anywhere in the repo, and nor is anything else in the table above.

That makes this latent rather than active. A call to a declaration the binary lacks fails at link time, which is loud. The quiet half is a macro or a struct that changed between the two versions: it compiles, and then it is wrong.

The change

The headers now come from the 3.4.4 source that build-mariadb.sh pins. mariadb_version.h is generated by CMake rather than shipped, so it is rendered from a configure run of that same source instead of copied, which is also what drops the Homebrew path.

scripts/check-mariadb-headers.sh reads the pinned version out of build-mariadb.sh, downloads that source, renders the generated header the same way, and diffs all fifteen. It is the shape check-duckdb-value-api.sh and check-pluginkit-abi.sh already use: a fact the tree hard-codes gets a script that re-checks it, rather than a comment asking the next person to remember.

Verification

Step Result
verify.sh build PASS
MySQLDriver scheme BUILD SUCCEEDED
scripts/check-mariadb-headers.sh every vendored header matches Connector/C 3.4.4
shellcheck --severity=warning clean

No library rebuild and no republish: the binary already is the pinned version, so Libs/ and its checksums are untouched.

Found while investigating #2427.

https://claude.ai/code/session_01KsqHrFwJxUW6eWozYjT8JZ

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin
datlechin merged commit 19ea8c3 into main Aug 26, 2026
7 checks passed
@datlechin
datlechin deleted the build/mariadb-header-parity branch August 26, 2026 09:05
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