From 911b14dd0ceca3147eb7758a5c40cc0d4451aca3 Mon Sep 17 00:00:00 2001 From: Alex Tymchuk Date: Wed, 30 Aug 2023 14:55:24 +0000 Subject: [PATCH] PMM-12375 use performance_schema for higher versions --- agent/connectionchecker/connection_checker.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/agent/connectionchecker/connection_checker.go b/agent/connectionchecker/connection_checker.go index 5a15e1b05b..1981575226 100644 --- a/agent/connectionchecker/connection_checker.go +++ b/agent/connectionchecker/connection_checker.go @@ -289,17 +289,17 @@ func (cc *ConnectionChecker) checkProxySQLConnection(ctx context.Context, dsn st res.Error = err.Error() } - // if _, err := db.ExecContext(ctx, "USE mysql"); err != nil { - // res.Error = err.Error() - // return &res - // } - var version string if err := db.QueryRowContext( ctx, "SELECT /* agent='connectionchecker' */ variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name = 'admin-version'").Scan(&version); err != nil { - res.Error = err.Error() - return &res + err := db.QueryRowContext( + ctx, + "SELECT /* agent='connectionchecker' */ variable_value FROM PERFORMANCE_SCHEMA.GLOBAL_VARIABLES WHERE variable_name = 'admin-version'").Scan(&version) + if err != nil { + res.Error = err.Error() + return &res + } } res.Stats = &agentpb.CheckConnectionResponse_Stats{