| 1 |
# ==== Purpose ==== |
| 2 |
# The purpose of this script is to test that binary logging returns an error |
| 3 |
# if more than one engine is involved and at least one of them it's doing its |
| 4 |
# own logging (is *self-logging*), which is the case for NDB engine. |
| 5 |
# |
| 6 |
# ==== Requirements ==== |
| 7 |
# |
| 8 |
# R1. When more than one engine is involved in binary logging and at least one |
| 9 |
# engine is self-logging then binary logging should return error |
| 10 |
# `ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE`. |
| 11 |
# |
| 12 |
# ==== Implementation ==== |
| 13 |
# |
| 14 |
# TC1. Verify that when more than one engine is involved in binary logging and |
| 15 |
# at least one engine is self-logging then binary logging should return |
| 16 |
# error `ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE`. |
| 17 |
# ------------------------------------------------------------------ |
| 18 |
# With BINLOG_FORMAT = ROW : |
| 19 |
# 1) Create a trigger which inserts data in MYISAM engine upon insertion of |
| 20 |
# data in NDB engine. |
| 21 |
# 2) Try to insert data in the NDB ENGINE. |
| 22 |
# 3) Verify that error `ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE` is returned. |
| 23 |
# 4) Verify that no data was inserted in the NDB engine. |
| 24 |
# 5) Verify that no data was inserted in MYISAM engine. |
| 25 |
# |
| 26 |
# ==== References ==== |
| 27 |
# |
| 28 |
# BUG#39934: Slave stops for engine that only support row-based logging |
| 29 |
# BUG#42829: binlogging enabled for all schemas regardless of binlog-db-db / |
| 30 |
# binlog-ignore-db |
| 31 |
# |
| 32 |
# ==== Related test cases ==== |
| 33 |
# |
| 34 |
# rpl.rpl_binlog_format_errors verifies that binary logging returns an error |
| 35 |
# for the conditions 1 to 7 listed in the comments section of method |
| 36 |
# decide_logging_format(). Condition 8 requires a self-logging engine which |
| 37 |
# is the case of NDB and therefore it is tested in this script. |
| 38 |
|
| 39 |
# Need debug so that 'SET @@session.debug' works. |
| 40 |
--source include/have_debug.inc |
| 41 |
# Need example plugin because it is the only statement-only engine. |
| 42 |
--source include/have_example_plugin.inc |
| 43 |
# The test changes binlog_format, so there is no reason to run it |
| 44 |
# under more than one binlog format. |
| 45 |
--source include/have_binlog_format_row.inc |
| 46 |
--source include/have_ndb.inc |
| 47 |
# The test requires MyISAM engine |
| 48 |
--source include/have_myisam.inc |
| 49 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 50 |
|
| 51 |
--disable_query_log |
| 52 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 53 |
CALL mtr.add_suppression("Cannot execute statement: impossible to write to binary log"); |
| 54 |
--enable_query_log |
| 55 |
|
| 56 |
--echo ==== Initialize ==== |
| 57 |
|
| 58 |
|
| 59 |
--echo [on master] |
| 60 |
--source include/rpl_connection_master.inc |
| 61 |
|
| 62 |
CREATE TABLE t (a VARCHAR(100)) ENGINE = MYISAM; |
| 63 |
CREATE TABLE t_self_logging (a VARCHAR(100)) ENGINE = NDB; |
| 64 |
|
| 65 |
--echo [on slave] |
| 66 |
--source include/sync_slave_sql_with_master.inc |
| 67 |
|
| 68 |
--echo [on master] |
| 69 |
--source include/rpl_connection_master.inc |
| 70 |
|
| 71 |
--echo ==== Test ==== |
| 72 |
|
| 73 |
--echo ---- binlog_format='row' ---- |
| 74 |
|
| 75 |
--echo * Modify tables of more than one engine, one of which is self-logging |
| 76 |
--eval CREATE TRIGGER trig_1 AFTER INSERT ON t_self_logging FOR EACH ROW BEGIN INSERT INTO t VALUES (1); END |
| 77 |
--error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE |
| 78 |
INSERT INTO t_self_logging VALUES (1); |
| 79 |
DROP trigger trig_1; |
| 80 |
SELECT * FROM t_self_logging /* Should be empty */; |
| 81 |
SELECT * FROM t /* Should be empty */; |
| 82 |
|
| 83 |
--echo ==== Clean up ==== |
| 84 |
DROP TABLE t, t_self_logging; |
| 85 |
--source include/sync_slave_sql_with_master.inc |
| 86 |
|
| 87 |
--source include/rpl_end.inc |