From 950d69610aff4b2ee2cfe83113d339eac1ba0668 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 27 Jan 2015 16:25:18 -0500 Subject: [PATCH] MDEV-7322: Option to allow setting the binlog_format with Galera At session scope, allow binlog_format to be changed to values other than ROW with a warning. --- mysql-test/suite/wsrep/r/binlog_format.result | 26 +++++++++++++------ mysql-test/suite/wsrep/t/binlog_format.test | 21 ++++++++++----- sql/sys_vars.cc | 13 ++++++---- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/wsrep/r/binlog_format.result b/mysql-test/suite/wsrep/r/binlog_format.result index 2ce3d0b49c5..d996371c056 100644 --- a/mysql-test/suite/wsrep/r/binlog_format.result +++ b/mysql-test/suite/wsrep/r/binlog_format.result @@ -1,28 +1,30 @@ -call mtr.add_suppression("WSREP: cannot get fake InnoDB transaction ID"); -call mtr.add_suppression("WSREP: Could not open saved state file for reading:.*"); call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format.*"); +call mtr.add_suppression("WSREP: cannot get fake InnoDB transaction ID"); +# +# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT +# 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' +Warnings: +Warning 1105 MariaDB Galera does not support binlog format: 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 +binlog_format STATEMENT 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' +Warnings: +Warning 1105 MariaDB Galera does not support binlog format: 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 +binlog_format MIXED CREATE TABLE IF NOT EXISTS test.t2 AS SELECT * FROM information_schema.routines WHERE 1 = 0; SET binlog_format=ROW; SHOW WARNINGS; @@ -34,6 +36,9 @@ CREATE TABLE IF NOT EXISTS test.t3 AS SELECT * FROM information_schema.routines DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +# +# MDEV-7322: Option to allow setting the binlog_format with Galera +# SET @@GLOBAL.binlog_format=STATEMENT; ERROR 42000: Variable 'binlog_format' can't be set to the value of 'STATEMENT' SHOW GLOBAL VARIABLES LIKE 'binlog_format'; @@ -44,6 +49,11 @@ ERROR 42000: Variable 'binlog_format' can't be set to the value of 'MIXED' SHOW GLOBAL VARIABLES LIKE 'binlog_format'; Variable_name Value binlog_format ROW +SET @@GLOBAL.binlog_format=DEFAULT; +ERROR 42000: Variable 'binlog_format' can't be set to the value of 'DEFAULT' +SHOW GLOBAL VARIABLES LIKE 'binlog_format'; +Variable_name Value +binlog_format ROW SET @@GLOBAL.binlog_format=ROW; SHOW GLOBAL VARIABLES LIKE 'binlog_format'; Variable_name Value diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test index 561e4d77ea9..a2dc8542322 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.test +++ b/mysql-test/suite/wsrep/t/binlog_format.test @@ -1,19 +1,18 @@ --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc -# -# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT -# -call mtr.add_suppression("WSREP: cannot get fake InnoDB transaction ID"); -call mtr.add_suppression("WSREP: Could not open saved state file for reading:.*"); + call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format.*"); +call mtr.add_suppression("WSREP: cannot get fake InnoDB transaction ID"); + +--echo # +--echo # MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT +--echo # 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'; @@ -26,6 +25,10 @@ DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; +--echo # +--echo # MDEV-7322: Option to allow setting the binlog_format with Galera +--echo # + -- error ER_WRONG_VALUE_FOR_VAR SET @@GLOBAL.binlog_format=STATEMENT; SHOW GLOBAL VARIABLES LIKE 'binlog_format'; @@ -34,6 +37,10 @@ SHOW GLOBAL VARIABLES LIKE 'binlog_format'; SET @@GLOBAL.binlog_format=MIXED; SHOW GLOBAL VARIABLES LIKE 'binlog_format'; +-- error ER_WRONG_VALUE_FOR_VAR +SET @@GLOBAL.binlog_format=DEFAULT; +SHOW GLOBAL VARIABLES LIKE 'binlog_format'; + SET @@GLOBAL.binlog_format=ROW; SHOW GLOBAL VARIABLES LIKE 'binlog_format'; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 561e3afcd54..f2592a3fd58 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -444,14 +444,17 @@ static bool binlog_format_check(sys_var *self, THD *thd, set_var *var) if (WSREP(thd) && var->save_result.ulonglong_value != BINLOG_FORMAT_ROW) { - WSREP_ERROR("MariaDB Galera does not support binlog format: %s", - binlog_format_names[var->save_result.ulonglong_value]); - - // Also push a warning because error message is general. + // Push a warning to the error log. push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, "MariaDB Galera does not support binlog format: %s", binlog_format_names[var->save_result.ulonglong_value]); - return true; + + if (var->type == OPT_GLOBAL) + { + WSREP_ERROR("MariaDB Galera does not support binlog format: %s", + binlog_format_names[var->save_result.ulonglong_value]); + return true; + } } #endif