From f70bcfa25d0e1c0a1f06e38a95ee35622129290d Mon Sep 17 00:00:00 2001 From: Seth Samuel Date: Thu, 12 Sep 2024 10:07:43 -0400 Subject: [PATCH] MySQL 8.4 (#18571) --- mysql/changelog.d/18571.fixed | 1 + mysql/datadog_checks/mysql/mysql.py | 6 +++++- mysql/hatch.toml | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 mysql/changelog.d/18571.fixed diff --git a/mysql/changelog.d/18571.fixed b/mysql/changelog.d/18571.fixed new file mode 100644 index 0000000000000..3cb9490939b9a --- /dev/null +++ b/mysql/changelog.d/18571.fixed @@ -0,0 +1 @@ +Fixed a bug in MySQL 8.4 where `SHOW MASTER STATUS` would fail diff --git a/mysql/datadog_checks/mysql/mysql.py b/mysql/datadog_checks/mysql/mysql.py index 0c77501ff5375..1e809531e9df7 100644 --- a/mysql/datadog_checks/mysql/mysql.py +++ b/mysql/datadog_checks/mysql/mysql.py @@ -1075,7 +1075,11 @@ def _get_replica_stats(self, db, is_mariadb, replication_channel): try: with closing(db.cursor(CommenterDictCursor)) as cursor: - cursor.execute("SHOW MASTER STATUS;") + if not self.is_mariadb and self.version.version_compatible((8, 4, 0)): + cursor.execute("SHOW BINARY LOG STATUS;") + else: + cursor.execute("SHOW MASTER STATUS;") + binlog_results = cursor.fetchone() if binlog_results: replica_results.update({'Binlog_enabled': True}) diff --git a/mysql/hatch.toml b/mysql/hatch.toml index 5baac07e67fa7..103bee10d87a2 100644 --- a/mysql/hatch.toml +++ b/mysql/hatch.toml @@ -18,6 +18,7 @@ python = ["3.11"] version = [ "5.7", # EOL October 21, 2023 "8.0.36", # EOL April, 2026 + "8.4.0", ] [[envs.default.matrix]] @@ -40,11 +41,13 @@ version = [ [envs.default.overrides] matrix.version.env-vars = [ { key = "COMPOSE_FILE", value = "mysql8.yaml", if = ["8.0.36"] }, + { key = "COMPOSE_FILE", value = "mysql8.yaml", if = ["8.4.0"] }, ] name."8.0-group".env-vars = [ { key = "COMPOSE_FILE", value = "mysql8-group.yaml" }, ] + [envs.default.env-vars] COMPOSE_FILE = "{matrix:flavor:mysql}.yaml" MYSQL_FLAVOR = "{matrix:flavor:mysql}"