Added metric MultiplexDisabled_ext #4241

In the output of PROXYSQL INTERNAL SESSION and stats_mysql_processlist.extended_info ,
MultiplexDisabled was only returning the output of MySQL_Connection::MultiplexDisabled() .
If there was a transaction, or an error, multiplexing was disabled but MultiplexDisabled() was
still reporting false. Therefore it was necessary to also check server_status flag and last_errno.
This commits intruduces MultiplexDisabled_ext , that reports the output of:
MySQL_Connection::MultiplexDisabled() || MySQL_Connection::isActiveTransaction()

This should make troubleshooting easier.

Also, removed any reference to deprecated STATUS_MYSQL_CONNECTION_TRANSACTION .

Closes #4241
pull/4430/head
René Cannaò 2 years ago
parent 2840e18e13
commit 41cd740701

@ -7,7 +7,7 @@
#include "../deps/json/json.hpp"
using json = nlohmann::json;
#define STATUS_MYSQL_CONNECTION_TRANSACTION 0x00000001
//#define STATUS_MYSQL_CONNECTION_TRANSACTION 0x00000001 // DEPRECATED
#define STATUS_MYSQL_CONNECTION_COMPRESSION 0x00000002
#define STATUS_MYSQL_CONNECTION_USER_VARIABLE 0x00000004
#define STATUS_MYSQL_CONNECTION_PREPARED_STATEMENT 0x00000008

@ -1191,7 +1191,6 @@ void MySQL_Session::generate_proxysql_internal_session_json(json &j) {
j["conn"]["client_flag"]["client_deprecate_eof"] = (client_myds->myconn->options.client_flag & CLIENT_DEPRECATE_EOF ? 1 : 0);
j["conn"]["no_backslash_escapes"] = client_myds->myconn->options.no_backslash_escapes;
j["conn"]["status"]["compression"] = client_myds->myconn->get_status(STATUS_MYSQL_CONNECTION_COMPRESSION);
j["conn"]["status"]["transaction"] = client_myds->myconn->get_status(STATUS_MYSQL_CONNECTION_TRANSACTION);
j["conn"]["ps"]["client_stmt_to_global_ids"] = client_myds->myconn->local_stmts->client_stmt_to_global_ids;
}
}
@ -1250,7 +1249,18 @@ void MySQL_Session::generate_proxysql_internal_session_json(json &j) {
j["backends"][i]["conn"]["status"]["prepared_statement"] = _myconn->get_status(STATUS_MYSQL_CONNECTION_PREPARED_STATEMENT);
j["backends"][i]["conn"]["status"]["has_warnings"] = _myconn->get_status(STATUS_MYSQL_CONNECTION_HAS_WARNINGS);
j["backends"][i]["conn"]["warning_count"] = _myconn->warning_count;
j["backends"][i]["conn"]["MultiplexDisabled"] = _myconn->MultiplexDisabled();
{
// MultiplexDisabled : status returned by MySQL_Connection::MultiplexDisabled();
// MultiplexDisabled_ext : status returned by MySQL_Connection::MultiplexDisabled() || MySQL_Connection::isActiveTransaction()
bool multiplex_disabled = _myconn->MultiplexDisabled();
j["backends"][i]["conn"]["MultiplexDisabled"] = multiplex_disabled;
if (multiplex_disabled == false) {
if (_myconn->IsActiveTransaction() == true) {
multiplex_disabled = true;
}
}
j["backends"][i]["conn"]["MultiplexDisabled_ext"] = multiplex_disabled;
}
j["backends"][i]["conn"]["ps"]["backend_stmt_to_global_ids"] = _myconn->local_stmts->backend_stmt_to_global_ids;
j["backends"][i]["conn"]["ps"]["global_stmt_to_backend_ids"] = _myconn->local_stmts->global_stmt_to_backend_ids;
j["backends"][i]["conn"]["client_flag"]["value"] = _myconn->options.client_flag;

@ -2492,7 +2492,7 @@ bool MySQL_Connection::MultiplexDisabled(bool check_delay_token) {
// status_flags stores information about the status of the connection
// can be used to determine if multiplexing can be enabled or not
bool ret=false;
if (status_flags & (STATUS_MYSQL_CONNECTION_TRANSACTION | STATUS_MYSQL_CONNECTION_USER_VARIABLE | STATUS_MYSQL_CONNECTION_PREPARED_STATEMENT |
if (status_flags & (STATUS_MYSQL_CONNECTION_USER_VARIABLE | STATUS_MYSQL_CONNECTION_PREPARED_STATEMENT |
STATUS_MYSQL_CONNECTION_LOCK_TABLES | STATUS_MYSQL_CONNECTION_TEMPORARY_TABLE | STATUS_MYSQL_CONNECTION_GET_LOCK | STATUS_MYSQL_CONNECTION_NO_MULTIPLEX |
STATUS_MYSQL_CONNECTION_SQL_LOG_BIN0 | STATUS_MYSQL_CONNECTION_FOUND_ROWS | STATUS_MYSQL_CONNECTION_NO_MULTIPLEX_HG |
STATUS_MYSQL_CONNECTION_HAS_SAVEPOINT | STATUS_MYSQL_CONNECTION_HAS_WARNINGS) ) {

Loading…
Cancel
Save