summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2020-12-19 09:41:14 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2020-12-19 09:43:13 +0200
commitd1e9a4c15c7ea4121408c21e02a0006a19689508 (patch)
tree660bec36236c2ce6db3a79d7099b7fb21cb5d05e
parent4e43e2f92d1b418dcc84ab8ab085ef1b9b1a066b (diff)
downloadmariadb-git-d1e9a4c15c7ea4121408c21e02a0006a19689508.tar.gz
MDEV-23065 : Crash after setting wsrep_on to ON dynamically and reconnect
At end_connection make sure we have wsrep before trying to free connection assigned to it.
-rw-r--r--mysql-test/suite/galera/r/galera#500.result2
-rw-r--r--mysql-test/suite/galera/t/galera#500.test7
-rw-r--r--sql/sql_connect.cc2
3 files changed, 10 insertions, 1 deletions
diff --git a/mysql-test/suite/galera/r/galera#500.result b/mysql-test/suite/galera/r/galera#500.result
index 7ba02c56053..2e3f659bd79 100644
--- a/mysql-test/suite/galera/r/galera#500.result
+++ b/mysql-test/suite/galera/r/galera#500.result
@@ -1,3 +1,5 @@
+connection node_1;
+connection node_2;
connection node_2;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options="gmcast.isolate=2";
diff --git a/mysql-test/suite/galera/t/galera#500.test b/mysql-test/suite/galera/t/galera#500.test
index 3c8490b6907..471620b32c1 100644
--- a/mysql-test/suite/galera/t/galera#500.test
+++ b/mysql-test/suite/galera/t/galera#500.test
@@ -8,6 +8,11 @@
--source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
# Force node_2 gcomm background thread to terminate via exception.
--connection node_2
--let $wsrep_cluster_address = `SELECT @@wsrep_cluster_address`
@@ -36,3 +41,5 @@ SET SESSION wsrep_on=0;
--connection node_2
CALL mtr.add_suppression("WSREP: exception from gcomm, backend must be restarted: Gcomm backend termination was requested by setting gmcast.isolate=2.");
+
+--source include/auto_increment_offset_restore.inc
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index b2900a20b28..aa7a877ed20 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1112,7 +1112,7 @@ void end_connection(THD *thd)
{
NET *net= &thd->net;
#ifdef WITH_WSREP
- if (WSREP(thd))
+ if (WSREP(thd) && wsrep)
{
wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id);
if (rcode) {