Add MySQL health check#31
Draft
mpeltekis wants to merge 1 commit into
Draft
Conversation
New "mysql" hc_type that connects to a MySQL, MariaDB or Percona database and runs a query, modeled on the Postgres check. It is a fully asynchronous, libevent-driven state machine built on the MariaDB Connector/C non-blocking API (mysql_real_connect / mysql_real_query / mysql_store_result *_start/*_cont), so it never blocks the event loop. A check passes when the query returns a single row with a single column equal to "1". Details: - Registered in the healthcheck factory; libmariadb wired into CMake. - MySQL client library initialised/finalised in main() alongside OpenSSL (init_libmysql / finish_libmysql). - Optional hc_tls enforces an encrypted connection, which allows a password-free "REQUIRE SSL" monitoring account, mirroring a Postgres "hostssl ... trust" rule. - README documents the check and its attributes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mpeltekis
force-pushed
the
m_mysqlhealtcheck
branch
from
July 14, 2026 14:38
c86f5b2 to
9b62c7f
Compare
| this->user = safe_get<string>(config, "hc_user", ""); | ||
| this->password = safe_get<string>(config, "hc_password", ""); | ||
| this->query = safe_get<string>(config, "hc_query", ""); | ||
| this->use_tls = safe_get<bool>(config, "hc_tls", false); |
Contributor
There was a problem hiding this comment.
I'm thinking to remove this config option and always force TLS.
Author
There was a problem hiding this comment.
would you rather remove it entirely or maybe set the default to true and we keep it as an option?
tbh i dont think we do use non tls anywhere at inno
Contributor
There was a problem hiding this comment.
I'm fine with having only TLS operation in the code. No need for parameters, just always force it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
mysqlhealth check for MySQL / MariaDB / Percona, modeled on the existing Postgres check.What it does
A fully asynchronous, libevent-driven state machine on the MariaDB Connector/C non-blocking API (
mysql_real_connect/mysql_real_query/mysql_store_result*_start/*_cont), so it never blocks the event loop. Passes when the query returns a single row / single column equal to1.Config
hc_port,hc_user,hc_password,hc_dbname,hc_query,hc_tls. To run password-free (like the Postgres check): omithc_password, sethc_tls, and use aREQUIRE SSLempty-password account — the equivalent of a Postgreshostssl ... trustrule.Testing
-Wextra -pedantic, release); 20/20 existing tests pass; clang-format clean.caching_sha2_password(8.4 default) and with the passwordlessREQUIRE SSL+hc_tlssetup.Notes
hc_tlsencrypts the channel but does not verify the server certificate (matches libpq's default);hc_ssl_ca-based verification can be added later.🤖 Generated with Claude Code