binlog_multi_engine.test 2.71 KB
Newer Older
1 2 3 4 5
# Test to test how logging is done depending on the capabilities of
# the engines. Unfortunately, we don't have a good row-only logging
# engine, and NDB does not really cut is since it is also
# self-logging. I'm using it nevertheless.

6 7
source include/have_blackhole.inc;
source include/have_ndb.inc;
8
source include/have_binlog_format_mixed_or_row.inc;
9 10 11 12 13

CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;

14 15
RESET MASTER;

16 17 18 19 20 21
SET SESSION BINLOG_FORMAT=STATEMENT;

INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);

UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
22 23 24 25 26 27 28

# I cannot use these statements since the rows logged to the NDB table
# eventually shows up in the binary log. I use them anyway, since once
# BUG#29222 is fixed, there will be a difference here.
echo *** Please look in binlog_multi_engine.test if you have a diff here ****;
START TRANSACTION;
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
29 30
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
31
COMMIT;
32 33 34 35 36

TRUNCATE t1m;
TRUNCATE t1b;
TRUNCATE t1n;

37 38 39 40
source include/show_binlog_events.inc;

RESET MASTER;

41 42 43 44 45 46 47
SET SESSION BINLOG_FORMAT=MIXED;

INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);

UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
48
error ER_BINLOG_LOGGING_IMPOSSIBLE;
49
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
50 51 52 53 54 55 56

# Not possible to test this since NDB writes its own binlog, which
# might cause it to be out of sync with the results from MyISAM.
# This will generate an error once BUG#28722 is fixed.

#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;

57
>>>>>>>
58
error ER_BINLOG_LOGGING_IMPOSSIBLE;
59 60 61 62 63 64
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;

TRUNCATE t1m;
TRUNCATE t1b;
TRUNCATE t1n;

65 66 67 68
source include/show_binlog_events.inc;

RESET MASTER;

69 70 71
SET SESSION BINLOG_FORMAT=ROW;

INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
72
error ER_BINLOG_LOGGING_IMPOSSIBLE;
73 74 75
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);

76
error ER_BINLOG_LOGGING_IMPOSSIBLE;
77
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
78
error ER_BINLOG_LOGGING_IMPOSSIBLE;
79
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
80 81 82 83 84 85 86

# Not possible to test this since NDB writes its own binlog, which
# might cause it to be out of sync with the results from MyISAM.
# This will generate an error once BUG#28722 is fixed.

#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;

87
error ER_BINLOG_LOGGING_IMPOSSIBLE;
88 89
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;

90 91 92 93
source include/show_binlog_events.inc;

RESET MASTER;

94
DROP TABLE t1m, t1b, t1n;
95