| 1 |
SET @old_binlog_format= @@global.binlog_format; |
| 2 |
Warnings: |
| 3 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 4 |
INSTALL PLUGIN example SONAME 'ha_example.so'; |
| 5 |
################################################################################ |
| 6 |
# Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog |
| 7 |
# format to STATEMENT and the transaction isolation level to READ COMMITTED as |
| 8 |
# such changes force Innodb to accept changes in the row format. |
| 9 |
# |
| 10 |
# When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed |
| 11 |
# any error should be triggered. |
| 12 |
# |
| 13 |
# In contrast, CREATE TABLE ... SELECT should trigger the following error: |
| 14 |
# ER_BINLOG_STMT_MODE_AND_ROW_ENGINE. |
| 15 |
################################################################################ |
| 16 |
SET binlog_format = STATEMENT; |
| 17 |
Warnings: |
| 18 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 19 |
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; |
| 20 |
CREATE TABLE t_row (a VARCHAR(100)) ENGINE = InnoDB; |
| 21 |
ALTER TABLE t_row ADD COLUMN b INT; |
| 22 |
CREATE TRIGGER trig_row BEFORE INSERT ON t_row FOR EACH ROW INSERT INTO t_stmt VALUES (1); |
| 23 |
CREATE INDEX i ON t_row(a); |
| 24 |
CREATE TABLE t_row_new ENGINE = InnoDB SELECT * FROM t_row; |
| 25 |
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. |
| 26 |
DROP TABLE t_row; |
| 27 |
|
| 28 |
|
| 29 |
################################################################################ |
| 30 |
# Verifies if ER_BINLOG_ROW_MODE_AND_STMT_ENGINE happens by setting the binlog |
| 31 |
# format to ROW and using a engine, i.e. EXAMPLE, that only supports STATEMENT. |
| 32 |
# |
| 33 |
# When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed |
| 34 |
# the error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE is not triggered. Note that other |
| 35 |
# errors are triggered due to restrictions in the engine. |
| 36 |
# |
| 37 |
# In contrast, CREATE TABLE ... SELECT should trigger the following error: |
| 38 |
# ER_BINLOG_ROW_MODE_AND_STMT_ENGINE. |
| 39 |
################################################################################ |
| 40 |
SET binlog_format = 'ROW'; |
| 41 |
Warnings: |
| 42 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 43 |
CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE; |
| 44 |
ALTER TABLE t_stmt ADD COLUMN b INT; |
| 45 |
ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE' |
| 46 |
CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1); |
| 47 |
CREATE INDEX i ON t_stmt(a); |
| 48 |
ERROR 42000: Too many keys specified; max 0 keys allowed |
| 49 |
CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt; |
| 50 |
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging. |
| 51 |
DROP TABLE t_stmt; |
| 52 |
|
| 53 |
|
| 54 |
################################################################################ |
| 55 |
# CLEAN UP # |
| 56 |
################################################################################ |
| 57 |
flush tables; |
| 58 |
UNINSTALL PLUGIN example; |
| 59 |
SET @@global.binlog_format = @old_binlog_format; |
| 60 |
Warnings: |
| 61 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 62 |
SET @@session.binlog_format = @old_binlog_format; |
| 63 |
Warnings: |
| 64 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |