1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

More fixes to variable wsrep_on

* Disallow setting wsrep_on = 1 if wsrep_provider is unset. Also, move
  wsrep_on_basic from sys_vars to wsrep suite: this test now requires
  to run with wsrep_provider set
* Disallow setting @@session.wsrep_on = 1 when @@global.wsrep_on = 0
* Handle the case where a new connection turns @@global.wsrep_on from
  off to on. In this case we would miss a call to wsrep_open, causing
  unexpected states in wsrep::client_state (causing assertions).
* Disable wsrep.MDEV-22443 because it is no longer possible to enable
  wsrep_on, if server is started with wsrep_provider='none'

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
This commit is contained in:
Daniele Sciascia
2021-04-14 22:40:46 +02:00
committed by Jan Lindström
parent 57caff245c
commit eb4123eefc
11 changed files with 237 additions and 16 deletions

View File

@ -14,3 +14,4 @@
mdev_6832: wsrep_provider is read-only for security reasons
MDEV-23092: wsrep_provider is read-only for security reasons
wsrep_variables_no_provider: wsrep_provider is read-only for security reasons
MDEV-22443: it is no longer allowed enable wsrep_on if wsrep_provider is 'none'

View File

@ -0,0 +1,50 @@
#
# wsrep_on
#
# save the initial values
SET @wsrep_on_global_saved = @@global.wsrep_on;
SET @wsrep_on_session_saved = @@session.wsrep_on;
# default
SELECT @@global.wsrep_on;
@@global.wsrep_on
1
SELECT @@session.wsrep_on;
@@session.wsrep_on
1
# scope and valid values
SET @@global.wsrep_on=OFF;
SELECT @@global.wsrep_on;
@@global.wsrep_on
0
SET @@global.wsrep_on=ON;
SELECT @@global.wsrep_on;
@@global.wsrep_on
1
SET @@session.wsrep_on=OFF;
SELECT @@session.wsrep_on;
@@session.wsrep_on
0
SET @@session.wsrep_on=ON;
SELECT @@session.wsrep_on;
@@session.wsrep_on
1
SET @@session.wsrep_on=default;
SELECT @@session.wsrep_on;
@@session.wsrep_on
1
# invalid values
SET @@global.wsrep_on=NULL;
ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'NULL'
SET @@global.wsrep_on='junk';
ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'junk'
SET @@session.wsrep_on=NULL;
ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'NULL'
SET @@session.wsrep_on='junk';
ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'junk'
# restore the initial values
SET @@global.wsrep_on = @wsrep_on_global_saved;
SET @@session.wsrep_on = @wsrep_on_session_saved;
# End of test

View File

@ -0,0 +1 @@
--wsrep-provider=$WSREP_PROVIDER --binlog_format=ROW --wsrep-cluster-address=gcomm://

View File

@ -0,0 +1,47 @@
--source include/have_wsrep.inc
--source include/have_wsrep_provider.inc
--source include/have_innodb.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