summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Sciascia <daniele.sciascia@galeracluster.com>2020-08-18 11:03:12 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2020-08-19 13:12:00 +0300
commitf8bf5b0f8431493975f8f4488d0bef6e0e4e289e (patch)
tree0dff5b5a30d0a4834a02378a91c34d7f1ef30b17
parentfe3284b2cc8cc4f948aa234b3c6f9f2f8cffa027 (diff)
downloadmariadb-git-f8bf5b0f8431493975f8f4488d0bef6e0e4e289e.tar.gz
MDEV-23466 SIGABRT on SELECT WSREP_LAST_SEEN_GTID
SELECT WSREP_LAST_SEEN_GTID aborts the server if no provider is loaded.
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-23466.result3
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23466.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23466.test10
-rw-r--r--sql/item_strfunc.cc10
4 files changed, 28 insertions, 3 deletions
diff --git a/mysql-test/suite/wsrep/r/MDEV-23466.result b/mysql-test/suite/wsrep/r/MDEV-23466.result
new file mode 100644
index 00000000000..6d167c9c95e
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-23466.result
@@ -0,0 +1,3 @@
+SELECT WSREP_LAST_SEEN_GTID();
+WSREP_LAST_SEEN_GTID()
+00000000-0000-0000-0000-000000000000:-1
diff --git a/mysql-test/suite/wsrep/t/MDEV-23466.cnf b/mysql-test/suite/wsrep/t/MDEV-23466.cnf
new file mode 100644
index 00000000000..851f2999a83
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23466.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+binlog-format=ROW
+wsrep-provider=none
+wsrep-cluster-address='gcomm://'
+innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-23466.test b/mysql-test/suite/wsrep/t/MDEV-23466.test
new file mode 100644
index 00000000000..2615298226e
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23466.test
@@ -0,0 +1,10 @@
+#
+# MDEV-23466: SIGABRT in wsrep::server_state::provider on
+# SELECT WSREP_LAST_SEEN_GTID() on optimized builds
+#
+
+--source include/have_innodb.inc
+--source include/have_wsrep.inc
+--source include/have_binlog_format_row.inc
+
+SELECT WSREP_LAST_SEEN_GTID();
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c735f697986..ea14e9d44f8 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -5379,9 +5379,13 @@ String *Item_func_wsrep_last_written_gtid::val_str_ascii(String *str)
String *Item_func_wsrep_last_seen_gtid::val_str_ascii(String *str)
{
- /* TODO: Should call Wsrep_server_state.instance().last_committed_gtid()
- instead. */
- wsrep::gtid gtid= Wsrep_server_state::instance().provider().last_committed_gtid();
+ wsrep::gtid gtid= wsrep::gtid::undefined();
+ if (Wsrep_server_state::instance().is_provider_loaded())
+ {
+ /* TODO: Should call Wsrep_server_state.instance().last_committed_gtid()
+ instead. */
+ gtid= Wsrep_server_state::instance().provider().last_committed_gtid();
+ }
if (gtid_str.alloc(wsrep::gtid_c_str_len()))
{
my_error(ER_OUTOFMEMORY, wsrep::gtid_c_str_len());