diff --git a/include/mysql_connection.h b/include/mysql_connection.h index 501ccd7610..5b90881517 100644 --- a/include/mysql_connection.h +++ b/include/mysql_connection.h @@ -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 diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 265696ce90..c6097ebca4 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -1194,7 +1194,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; } } @@ -1253,7 +1252,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; diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index 4400d7ec9b..458c581858 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -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) ) {