summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlfranio Correia <alfranio.correia@sun.com>2010-01-14 12:52:28 +0000
committerAlfranio Correia <alfranio.correia@sun.com>2010-01-14 12:52:28 +0000
commiteef6ea03d20767f4b56ca07d20d9686a6c83c29f (patch)
tree2ff2891bd6f6c1b8003ae10b9894b7e485984c57 /mysql-test
parent54b2371e92a723ee9d44c282b3b1c5b7baf50f89 (diff)
downloadmariadb-git-eef6ea03d20767f4b56ca07d20d9686a6c83c29f.tar.gz
Augmented the rpl_ndb_binlog_format_errors to verify if a slave running in the
STMT mode aborts the SQL Thread if it receives changes in ROW mode and such changes are not processed.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result42
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test28
2 files changed, 63 insertions, 7 deletions
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
index f15cb7775ca..35f54455179 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
@@ -37,14 +37,22 @@ CREATE TRIGGER trig_1 AFTER INSERT ON t_self_logging FOR EACH ROW BEGIN INSERT I
INSERT INTO t_self_logging VALUES (1);
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
DROP trigger trig_1;
+SELECT * FROM t_self_logging /* Should be empty */;
+a
+SELECT * FROM t /* Should be empty */;
+a
* Modify both row-only and stmt-only table
CREATE TRIGGER trig_2 AFTER INSERT ON t_stmt FOR EACH ROW BEGIN INSERT INTO t_row VALUES(1); END;
INSERT INTO t_stmt VALUES (1);
ERROR HY000: Cannot execute statement: binlogging impossible since both row-incapable engines and statement-incapable engines are involved.
+SELECT * FROM t_stmt /* should be empty */;
+a
DROP TRIGGER trig_2;
* Stmt-only table and binlog_format=row
INSERT INTO t_stmt VALUES (1);
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-logging.
+SELECT * FROM t_stmt /* should be empty */;
+a
* Row injection and stmt-only table: in slave sql thread
INSERT INTO t_slave_stmt VALUES (1);
[on slave]
@@ -52,12 +60,17 @@ INSERT INTO t_slave_stmt VALUES (1);
Last_SQL_Error = Error 'Cannot execute row injection: binlogging impossible since at least one table uses a storage engine limited to statement-logging.' on opening tables
set global sql_slave_skip_counter=1;
include/start_slave.inc
+SELECT * FROM t_slave_stmt /* should be empty */;
+a
+[on master]
* Row injection and stmt-only table: use BINLOG statement
BINLOG '
1gRVShMBAAAALwAAAEABAAAAABcAAAAAAAAABHRlc3QABnRfc3RtdAABDwJkAAE=
1gRVShcBAAAAIAAAAGABAAAQABcAAAAAAAEAAf/+ATE=
';
ERROR HY000: Cannot execute row injection: binlogging impossible since at least one table uses a storage engine limited to statement-logging.
+SELECT * FROM t_stmt /* should be empty */;
+a
---- binlog_format=mixed ----
[on slave]
include/stop_slave.inc
@@ -83,21 +96,30 @@ SET @@session.binlog_format = STATEMENT;
* Row-only engine and binlog_format=statement: innodb-specific message
INSERT INTO t_row VALUES (1);
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
+SELECT * FROM t_row /* should be empty */;
+a
* Row-only engine and binlog_format=statement: generic message
SET @@session.debug= '+d,no_innodb_binlog_errors';
INSERT INTO t_row VALUES (1);
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging.
+SELECT * FROM t_row /* should be empty */;
+a
* Same statement, but db filtered out - no error
USE other;
INSERT INTO test.t_row VALUES (1);
USE test;
SET @@session.debug= '';
+SELECT * FROM t_row /* should contain the value 1 */;
+a
+1
* Row injection and binlog_format=statement: BINLOG statement
BINLOG '
cNpVShMBAAAAKgAAADYBAAAAABcAAAAAAAAABHRlc3QAAXQAAQ8CZAAB
cNpVShcBAAAAIAAAAFYBAAAQABcAAAAAAAEAAf/+ATE=
';
ERROR HY000: Cannot execute row injection: binlogging impossible since BINLOG_FORMAT = STATEMENT.
+SELECT * FROM t /* should be empty */;
+a
* Same statement, but db filtered out - no error
USE other;
BINLOG '
@@ -105,24 +127,38 @@ cNpVShMBAAAAKgAAADYBAAAAABcAAAAAAAAABHRlc3QAAXQAAQ8CZAAB
cNpVShcBAAAAIAAAAFYBAAAQABcAAAAAAAEAAf/+ATE=
';
USE test;
+SELECT * FROM t /* should contain the value 1 */;
+a
+1
+DELETE FROM t;
* Unsafe statement and binlog_format=statement
-INSERT INTO t VALUES (UUID());
+INSERT INTO t VALUES (COALESCE(1, UUID()));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
+SELECT * FROM t /* should contain the value 1 */;
+a
+1
+DELETE FROM t;
* Same statement, but db filtered out - no message
USE other;
-INSERT INTO test.t VALUES (UUID());
+INSERT INTO test.t VALUES (COALESCE(1, UUID()));
USE test;
+SELECT * FROM t /* should contain the value 1 */;
+a
+1
+DELETE FROM t;
---- master: binlog_format=mixed, slave: binlog_format=statement ----
SET @@global.binlog_format = MIXED;
SET @@session.binlog_format = MIXED;
* Row injection and binlog_format=statement: in slave sql thread
-INSERT INTO t VALUES (UUID());
+INSERT INTO t VALUES (COALESCE(1, UUID()));
[on slave]
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Cannot execute row injection: binlogging impossible since BINLOG_FORMAT = STATEMENT.' on opening tables
set global sql_slave_skip_counter=1;
include/start_slave.inc
+SELECT * FROM t /* should be empty */;
+a
[on master]
==== Clean up ====
DROP TRIGGER trig_autoinc;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
index 4daacb10a0a..8153b60e324 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test
@@ -93,16 +93,20 @@ AAAAAAAAAAAAAAAAAADWBFVKEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
--error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
INSERT INTO t_self_logging VALUES (1);
DROP trigger trig_1;
+SELECT * FROM t_self_logging /* Should be empty */;
+SELECT * FROM t /* Should be empty */;
--echo * Modify both row-only and stmt-only table
--eval CREATE TRIGGER trig_2 AFTER INSERT ON t_stmt FOR EACH ROW BEGIN INSERT INTO t_row VALUES(1); END
--error ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE
INSERT INTO t_stmt VALUES (1);
+SELECT * FROM t_stmt /* should be empty */;
DROP TRIGGER trig_2;
--echo * Stmt-only table and binlog_format=row
--error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE
INSERT INTO t_stmt VALUES (1);
+SELECT * FROM t_stmt /* should be empty */;
--echo * Row injection and stmt-only table: in slave sql thread
INSERT INTO t_slave_stmt VALUES (1);
@@ -112,7 +116,11 @@ INSERT INTO t_slave_stmt VALUES (1);
--let $slave_sql_errno= 1642
--let $show_sql_error= 1
--source include/wait_for_slave_sql_error_and_skip.inc
+--connection slave
+SELECT * FROM t_slave_stmt /* should be empty */;
+--echo [on master]
+--connection master
--echo * Row injection and stmt-only table: use BINLOG statement
# This is a Table_map_event and a Write_rows_event. Together, they are
# equivalent to 'INSERT INTO t_stmt VALUES (1)'
@@ -121,6 +129,7 @@ BINLOG '
1gRVShMBAAAALwAAAEABAAAAABcAAAAAAAAABHRlc3QABnRfc3RtdAABDwJkAAE=
1gRVShcBAAAAIAAAAGABAAAQABcAAAAAAAEAAf/+ATE=
';
+SELECT * FROM t_stmt /* should be empty */;
--echo ---- binlog_format=mixed ----
@@ -161,6 +170,7 @@ SET @@session.binlog_format = STATEMENT;
--echo * Row-only engine and binlog_format=statement: innodb-specific message
--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
INSERT INTO t_row VALUES (1);
+SELECT * FROM t_row /* should be empty */;
# Commented out since innodb gives an error (this is a bug)
#--echo * Same statement, but db filtered out - no error
@@ -172,12 +182,14 @@ INSERT INTO t_row VALUES (1);
SET @@session.debug= '+d,no_innodb_binlog_errors';
--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
INSERT INTO t_row VALUES (1);
+SELECT * FROM t_row /* should be empty */;
--echo * Same statement, but db filtered out - no error
USE other;
INSERT INTO test.t_row VALUES (1);
USE test;
SET @@session.debug= '';
+SELECT * FROM t_row /* should contain the value 1 */;
--echo * Row injection and binlog_format=statement: BINLOG statement
# This is a Table_map_event and a Write_rows_event. Together, they are
@@ -187,6 +199,7 @@ BINLOG '
cNpVShMBAAAAKgAAADYBAAAAABcAAAAAAAAABHRlc3QAAXQAAQ8CZAAB
cNpVShcBAAAAIAAAAFYBAAAQABcAAAAAAAEAAf/+ATE=
';
+SELECT * FROM t /* should be empty */;
--echo * Same statement, but db filtered out - no error
# This is a Table_map_event and a Write_rows_event. Together, they are
@@ -197,15 +210,21 @@ cNpVShMBAAAAKgAAADYBAAAAABcAAAAAAAAABHRlc3QAAXQAAQ8CZAAB
cNpVShcBAAAAIAAAAFYBAAAQABcAAAAAAAEAAf/+ATE=
';
USE test;
+SELECT * FROM t /* should contain the value 1 */;
+DELETE FROM t;
--echo * Unsafe statement and binlog_format=statement
# This will give a warning.
-INSERT INTO t VALUES (UUID());
+INSERT INTO t VALUES (COALESCE(1, UUID()));
+SELECT * FROM t /* should contain the value 1 */;
+DELETE FROM t;
--echo * Same statement, but db filtered out - no message
USE other;
-INSERT INTO test.t VALUES (UUID());
+INSERT INTO test.t VALUES (COALESCE(1, UUID()));
USE test;
+SELECT * FROM t /* should contain the value 1 */;
+DELETE FROM t;
--echo ---- master: binlog_format=mixed, slave: binlog_format=statement ----
@@ -214,14 +233,15 @@ SET @@global.binlog_format = MIXED;
SET @@session.binlog_format = MIXED;
--echo * Row injection and binlog_format=statement: in slave sql thread
-INSERT INTO t VALUES (UUID());
+INSERT INTO t VALUES (COALESCE(1, UUID()));
--echo [on slave]
--connection slave
# 1644 = ER_BINLOG_ROW_INJECTION_AND_STMT_MODE
--let $slave_sql_errno= 1644
--let $show_sql_error= 1
--source include/wait_for_slave_sql_error_and_skip.inc
-
+--connection slave
+SELECT * FROM t /* should be empty */;
--echo [on master]
--connection master