summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2022-10-06 08:51:16 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2022-10-06 13:08:20 +0300
commit09f7889b5c2039c55dc52e199f81862279192ce8 (patch)
treec022c2be591d4bcc298159b6f2ee6deed5c2065c
parent074e358213ac8f358fa01c2c03ed58e94c81baf8 (diff)
downloadmariadb-git-09f7889b5c2039c55dc52e199f81862279192ce8.tar.gz
MDEV-29706 : SIGSEGV in wsrep_TOI_begin on non-Galera builds
Do not allow setting wsrep_on=ON if no provider is set.
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_on_without_provider.result5
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_on_basic.test45
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test9
-rw-r--r--sql/wsrep_var.cc6
4 files changed, 20 insertions, 45 deletions
diff --git a/mysql-test/suite/sys_vars/r/wsrep_on_without_provider.result b/mysql-test/suite/sys_vars/r/wsrep_on_without_provider.result
new file mode 100644
index 00000000000..525619dba29
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/wsrep_on_without_provider.result
@@ -0,0 +1,5 @@
+SET GLOBAL wsrep_on=ON;
+ERROR HY000: WSREP (galera) can't be enabled if the wsrep_provider is unset or set to 'none'
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+0
diff --git a/mysql-test/suite/sys_vars/t/wsrep_on_basic.test b/mysql-test/suite/sys_vars/t/wsrep_on_basic.test
deleted file mode 100644
index 229d771b5e7..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_on_basic.test
+++ /dev/null
@@ -1,45 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_on
---echo #
-
---echo # save the initial values
-SET @wsrep_on_global_saved = @@global.wsrep_on;
-SET @wsrep_on_session_saved = @@session.wsrep_on;
-
---echo # default
-SELECT @@global.wsrep_on;
-SELECT @@session.wsrep_on;
-
---echo
---echo # scope and valid values
-SET @@global.wsrep_on=OFF;
-SELECT @@global.wsrep_on;
-SET @@global.wsrep_on=ON;
-SELECT @@global.wsrep_on;
-
-SET @@session.wsrep_on=OFF;
-SELECT @@session.wsrep_on;
-SET @@session.wsrep_on=ON;
-SELECT @@session.wsrep_on;
-SET @@session.wsrep_on=default;
-SELECT @@session.wsrep_on;
-
---echo
---echo # invalid values
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.wsrep_on=NULL;
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.wsrep_on='junk';
---error ER_WRONG_VALUE_FOR_VAR
-SET @@session.wsrep_on=NULL;
---error ER_WRONG_VALUE_FOR_VAR
-SET @@session.wsrep_on='junk';
-
---echo
---echo # restore the initial values
-SET @@global.wsrep_on = @wsrep_on_global_saved;
-SET @@session.wsrep_on = @wsrep_on_session_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test b/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test
new file mode 100644
index 00000000000..5bee3c9a356
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test
@@ -0,0 +1,9 @@
+--source include/not_embedded.inc
+
+#
+# @@global.wsrep_on is not allowed if there
+# is no wsrep_provider
+#
+--error ER_WRONG_ARGUMENTS
+SET GLOBAL wsrep_on=ON;
+SELECT @@global.wsrep_on; \ No newline at end of file
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 413550935cb..ea8db8addab 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -70,6 +70,12 @@ bool wsrep_on_check(sys_var *self, THD* thd, set_var* var)
" innodb_lock_schedule_algorithm=FCFS and restart.", MYF(0));
return true;
}
+ if (new_wsrep_on && !WSREP_PROVIDER_EXISTS)
+ {
+ my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) can't be enabled "
+ "if the wsrep_provider is unset or set to 'none'", MYF(0));
+ return true;
+ }
return false;
}