From 4ae5a44db1619b346ac0ccf75d8b65dd905938a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 22 Jul 2022 21:04:31 +0000 Subject: [PATCH] Workaround for Galera bug 613 if: mysql-reset_connection_algorithm=1 and mysql-connpoll_reset_queue_length=0 we will not return a connection with connection_quality_level == 1 because we want to run COM_CHANGE_USER This change was introduced to work around Galera bug https://github.com/codership/galera/issues/613 --- lib/MySQL_HostGroups_Manager.cpp | 17 +++++++++++++++++ test/tap/tests/clickhouse_php_conn-t | 0 2 files changed, 17 insertions(+) mode change 100755 => 100644 test/tap/tests/clickhouse_php_conn-t diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 911a38f3d..f19489a1c 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -3160,6 +3160,23 @@ void MySrvConnList::get_random_MyConn_inner_search(unsigned int start, unsigned conn_found_idx = k; } } + } else { + if (connection_quality_level == 1) { + int rca = mysql_thread___reset_connection_algorithm; + if (rca==1) { + int ql = GloMTH->variables.connpoll_reset_queue_length; + if (ql==0) { + // if: + // mysql-reset_connection_algorithm=1 and + // mysql-connpoll_reset_queue_length=0 + // we will not return a connection with connection_quality_level == 1 + // because we want to run COM_CHANGE_USER + // This change was introduced to work around Galera bug + // https://github.com/codership/galera/issues/613 + connection_quality_level = 0; + } + } + } } } } diff --git a/test/tap/tests/clickhouse_php_conn-t b/test/tap/tests/clickhouse_php_conn-t old mode 100755 new mode 100644