From 9c88f37bf5e246cdc3a2d32c0a42405cc219f2f3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Sep 2006 17:25:13 +0300 Subject: [PATCH] Bug#22067 rpl_rbr_to_sbr and some other fail if NDB is default storage A query SET @@GLOBAL.binlog_format = ... returns an error when NDB is the default storage. This fails some tests invoking the set binlog_format explicitly. because the var turns to be read-only. In the following are files and method to fix if needed. t/ ndb_binlog_basic2.test # here the failure is benign rpl_rbr_to_sbr.test # does not check any ndb features => . # => not_ndb_default is enough rpl_row_basic_8partition.test # set binlog_format can be replaced rpl_switch_stm_row_mixed.test # does not check any ndb features => . # => not_ndb_default is enough two more invoking invoke extra/rpl_truncate_helper.test rpl_truncate_2myisam # to be fixed with not_ndb_default rpl_truncate_3innodb # same as above . # because there is a dedicated to ndb . . # rpl_truncate_7ndb* suit. Adapting/testing a new implement --source include/safe_set_to_maybe_ro_var.inc to avoid abort due to the error using binlog_format as application. BitKeeper/etc/ignore: Added mysql-test/t/rpl_truncate_4ndb.test to the ignore list mysql-test/r/rpl_row_basic_8partition.result: new results mysql-test/t/rpl_rbr_to_sbr.test: # does not check any ndb features => not_ndb_default is enough mysql-test/t/rpl_row_basic_8partition.test: set binlog_format can be read-only because of e.g default storage ndb. adapting/testing a new implement --source include/safe_set_to_maybe_ro_var.inc to avoid abort due to the error. Note, that it this particular test we could simply remove SET binlog_format because there is have_binlog_format_row require, as the test is about RBR. Futhermore utilizing safe_set_to_maybe_ro_var is redundat as well as long as we keep non_ndb_default guard. The latter is introduced because of ndb partitioning per-key limitation #19259: rpl_ndb_dd_partitions fails on solaris. The page is updated to refer to this test's. mysql-test/t/rpl_switch_stm_row_mixed.test: excluding ndb option, no ndb features mysql-test/t/rpl_truncate_2myisam.test: ndb checks truncate separately mysql-test/t/rpl_truncate_3innodb.test: ndb checks truncate separately mysql-test/include/safe_set_to_maybe_ro_var.inc: pseudo-macro to make read-only global/session vars "settable" in sense that SET var= val won't produce any error nor aborts testing. --- .bzrignore | 1 + .../include/safe_set_to_maybe_ro_var.inc | 23 +++++++++++++++++++ mysql-test/r/rpl_row_basic_8partition.result | 5 +++- mysql-test/t/rpl_rbr_to_sbr.test | 1 + mysql-test/t/rpl_row_basic_8partition.test | 7 +++++- mysql-test/t/rpl_switch_stm_row_mixed.test | 1 + mysql-test/t/rpl_truncate_2myisam.test | 2 +- mysql-test/t/rpl_truncate_3innodb.test | 1 + 8 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 mysql-test/include/safe_set_to_maybe_ro_var.inc diff --git a/.bzrignore b/.bzrignore index 1cf0cf7b889..fcacbd7c726 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1791,3 +1791,4 @@ vio/viotest-sslconnect.cpp vio/viotest.cpp zlib/*.ds? zlib/*.vcproj +mysql-test/t/rpl_truncate_4ndb.test diff --git a/mysql-test/include/safe_set_to_maybe_ro_var.inc b/mysql-test/include/safe_set_to_maybe_ro_var.inc new file mode 100644 index 00000000000..add7f2091b3 --- /dev/null +++ b/mysql-test/include/safe_set_to_maybe_ro_var.inc @@ -0,0 +1,23 @@ +# to mask out the error - never abort neither log in result file - in setting +# to read-only variable. +# It is assumed that the new value is equal to one the var was set to. +# Such situation happens particularily with binlog_format that becomes read-only +# with ndb default storage. +# +# when generate results always watch the file to find what is expected, +# the SET query may fail + +# script accepts $maybe_ro_var the var name and $val4var the value + +### USAGE: +### let $maybe_ro_var= ... +### let $val4var= ... +### include/safe_set_to_maybe_ro_var.inc + +--disable_result_log +--disable_abort_on_error +eval SET $maybe_ro_var = $val4var; +--enable_abort_on_error +--enable_result_log + +eval SELECT $maybe_ro_var; diff --git a/mysql-test/r/rpl_row_basic_8partition.result b/mysql-test/r/rpl_row_basic_8partition.result index a6728303a4c..dedd5d044e0 100644 --- a/mysql-test/r/rpl_row_basic_8partition.result +++ b/mysql-test/r/rpl_row_basic_8partition.result @@ -5,7 +5,10 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; DROP TABLE IF EXISTS t1; -SET BINLOG_FORMAT=ROW; +SET @@BINLOG_FORMAT = ROW; +SELECT @@BINLOG_FORMAT; +@@BINLOG_FORMAT +ROW **** Partition RANGE testing **** CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test index 83a9b08c344..0c5368197b3 100644 --- a/mysql-test/t/rpl_rbr_to_sbr.test +++ b/mysql-test/t/rpl_rbr_to_sbr.test @@ -1,5 +1,6 @@ -- source include/have_row_based.inc -- source include/have_binlog_format_mixed_or_statement.inc +-- source include/not_ndb_default.inc -- source include/master-slave.inc # Test that the slave temporarily switches to ROW when seeing binrow diff --git a/mysql-test/t/rpl_row_basic_8partition.test b/mysql-test/t/rpl_row_basic_8partition.test index 640a420c10e..f262ef05c58 100644 --- a/mysql-test/t/rpl_row_basic_8partition.test +++ b/mysql-test/t/rpl_row_basic_8partition.test @@ -8,12 +8,17 @@ ############################################################ --source include/have_row_based.inc +--source include/have_binlog_format_row.inc --source include/have_partition.inc +--source include/not_ndb_default.inc --source include/master-slave.inc connection master; --disable_warnings DROP TABLE IF EXISTS t1; -SET BINLOG_FORMAT=ROW; + +let $maybe_ro_var = @@BINLOG_FORMAT; +let $val4var = ROW; +--source include/safe_set_to_maybe_ro_var.inc --echo **** Partition RANGE testing **** diff --git a/mysql-test/t/rpl_switch_stm_row_mixed.test b/mysql-test/t/rpl_switch_stm_row_mixed.test index 4066794d519..d345b62b8eb 100644 --- a/mysql-test/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/t/rpl_switch_stm_row_mixed.test @@ -1,4 +1,5 @@ -- source include/have_row_based.inc +-- source include/not_ndb_default.inc -- source include/master-slave.inc connection master; diff --git a/mysql-test/t/rpl_truncate_2myisam.test b/mysql-test/t/rpl_truncate_2myisam.test index 1a2cb1d0fb3..a0f0ea04f44 100644 --- a/mysql-test/t/rpl_truncate_2myisam.test +++ b/mysql-test/t/rpl_truncate_2myisam.test @@ -1,4 +1,4 @@ - +--source include/not_ndb_default.inc let $engine=MyISAM; --source extra/rpl_tests/rpl_truncate.test diff --git a/mysql-test/t/rpl_truncate_3innodb.test b/mysql-test/t/rpl_truncate_3innodb.test index 7f3145feb1b..a31fd62a29a 100644 --- a/mysql-test/t/rpl_truncate_3innodb.test +++ b/mysql-test/t/rpl_truncate_3innodb.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc +--source include/not_ndb_default.inc let $engine=InnoDB; --source extra/rpl_tests/rpl_truncate.test