Commit 9379edb6 authored by Jan Lindström's avatar Jan Lindström

MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT

Analysis: Currently you can set binlog_format to STATEMENT or MIXED 
even when they are not really supported by galera.

Fix: Produce an error message if binlog_format is set to STATEMENT
or MIXED and wsrep_on = ON. Added a test case for this.
parent 730466b3
-- require r/have_wsrep.require
disable_query_log;
show variables like 'wsrep_on';
enable_query_log;
Variable_name Value
wsrep_on ON
SHOW VARIABLES LIKE 'binlog_format';
Variable_name Value
binlog_format ROW
SET binlog_format=STATEMENT;
ERROR 42000: Variable 'binlog_format' can't be set to the value of 'STATEMENT'
SHOW WARNINGS;
Level Code Message
Warning 1105 MariaDB Galera does not support binlog format: STATEMENT
Error 1231 Variable 'binlog_format' can't be set to the value of 'STATEMENT'
SHOW VARIABLES LIKE 'binlog_format';
Variable_name Value
binlog_format ROW
CREATE TABLE IF NOT EXISTS test.t1 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
SET binlog_format=MIXED;
ERROR 42000: Variable 'binlog_format' can't be set to the value of 'MIXED'
SHOW WARNINGS;
Level Code Message
Warning 1105 MariaDB Galera does not support binlog format: MIXED
Error 1231 Variable 'binlog_format' can't be set to the value of 'MIXED'
SHOW VARIABLES LIKE 'binlog_format';
Variable_name Value
binlog_format ROW
CREATE TABLE IF NOT EXISTS test.t2 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
SET binlog_format=ROW;
SHOW WARNINGS;
Level Code Message
SHOW VARIABLES LIKE 'binlog_format';
Variable_name Value
binlog_format ROW
CREATE TABLE IF NOT EXISTS test.t3 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
--binlog-format=row --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --wsrep-provider=/usr/lib/libgalera_smm.so --wsrep-cluster-address=gcomm:// --wsrep-on=1 --log-bin
\ No newline at end of file
--source include/have_wsrep.inc
--source include/have_binlog_format_row.inc
#
# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT
#
SHOW VARIABLES LIKE 'binlog_format';
-- error ER_WRONG_VALUE_FOR_VAR
SET binlog_format=STATEMENT;
SHOW WARNINGS;
SHOW VARIABLES LIKE 'binlog_format';
CREATE TABLE IF NOT EXISTS test.t1 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
-- error ER_WRONG_VALUE_FOR_VAR
SET binlog_format=MIXED;
SHOW WARNINGS;
SHOW VARIABLES LIKE 'binlog_format';
CREATE TABLE IF NOT EXISTS test.t2 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
SET binlog_format=ROW;
SHOW WARNINGS;
SHOW VARIABLES LIKE 'binlog_format';
CREATE TABLE IF NOT EXISTS test.t3 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
...@@ -308,6 +308,26 @@ static bool binlog_format_check(sys_var *self, THD *thd, set_var *var) ...@@ -308,6 +308,26 @@ static bool binlog_format_check(sys_var *self, THD *thd, set_var *var)
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT)) ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT))
return true; return true;
#ifdef WITH_WSREP
/* MariaDB Galera does not support STATEMENT or MIXED binlog
format currently */
if (WSREP(thd) &&
(var->save_result.ulonglong_value == BINLOG_FORMAT_STMT ||
var->save_result.ulonglong_value == BINLOG_FORMAT_MIXED))
{
WSREP_DEBUG("MariaDB Galera does not support binlog format : %s",
var->save_result.ulonglong_value == BINLOG_FORMAT_STMT ?
"STATEMENT" : "MIXED");
/* Push also warning, because error message is general */
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR,
"MariaDB Galera does not support binlog format: %s",
var->save_result.ulonglong_value == BINLOG_FORMAT_STMT ?
"STATEMENT" : "MIXED");
return true;
}
#endif
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment