32
33
INSERT INTO t2 VALUES (6, 6);
34
35
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
38
SELECT * FROM t1 ORDER BY a;
40
sync_slave_with_master;
41
SELECT * FROM t1 ORDER BY a;
43
# Now do the same for MyISAM
47
eval CREATE TABLE t1 (
48
a int unsigned not null auto_increment primary key,
51
) ENGINE=$engine_type2;
53
INSERT INTO t1 VALUES (1, 1);
54
INSERT INTO t1 VALUES (2, 2);
55
INSERT INTO t1 VALUES (3, 3);
56
INSERT INTO t1 VALUES (4, 4);
58
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
60
SELECT * FROM t1 ORDER BY a;
62
sync_slave_with_master;
63
SELECT * FROM t1 ORDER BY a;
36
--let $assert_cond= COUNT(*) = 6 FROM t1
37
--let $assert_text= Count of elements in t1 should be 6.
38
--source include/assert.inc
40
# Compare master and slave
41
--sync_slave_with_master
42
--let $diff_tables= master:test.t1 , slave:test.t1
43
--source include/diff_tables.inc
45
# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
46
# An insert ignore that does not update anything must be written to the binary log in SBR
47
# and MIXED modes. We check this property by counting occurrences in t1 before and after
48
# the insert and comparing the binlog positions. The count should be the same in both points
49
# and the statement should be in the binary log.
51
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
52
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
53
--let $statement_file=INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
54
--eval $statement_file
56
--let $assert_cond= COUNT(*) = 6 FROM t1
57
--let $assert_text= Count of elements in t1 should be 6.
58
--source include/assert.inc
60
if (`SELECT @@BINLOG_FORMAT = 'ROW'`)
62
--let $binlog_position_cmp= =
63
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
64
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
66
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`)
68
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\'
69
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
71
if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`)
73
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\'
74
--let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged.
76
--source include/assert.inc
67
sync_slave_with_master;
81
--sync_slave_with_master