31
31
INSERT INTO t2 VALUES (4, 3);
32
32
INSERT INTO t2 VALUES (5, 4);
33
33
INSERT INTO t2 VALUES (6, 6);
34
--disable_warnings ONCE
35
35
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
36
36
--let $assert_cond= COUNT(*) = 6 FROM t1
37
37
--let $assert_text= Count of elements in t1 should be 6.
51
51
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
52
52
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
53
53
--let $statement_file=INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a
54
--disable_warnings ONCE
54
55
--eval $statement_file
56
57
--let $assert_cond= COUNT(*) = 6 FROM t1
57
58
--let $assert_text= Count of elements in t1 should be 6.
58
59
--source include/assert.inc
60
if (`SELECT @@BINLOG_FORMAT = 'ROW'`)
61
if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`)
62
63
--let $binlog_position_cmp= =
63
64
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
64
65
--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'`)
67
if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`)
68
69
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\'
69
70
--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
--source include/assert.inc
73
--source include/assert.inc
75
# An insert duplicate that does not update anything must be written to the binary
76
# log in SBR and MIXED modes. We check this property by summing a before and after
77
# the update and comparing the binlog positions. The sum should be the same at both
78
# points and the statement should be in the binary log.
83
eval CREATE TABLE t1 (
84
a INT UNSIGNED NOT NULL PRIMARY KEY
85
) ENGINE=$engine_type;
87
eval CREATE TABLE t2 (
89
) ENGINE=$engine_type;
91
INSERT INTO t1 VALUES (1);
92
INSERT INTO t2 VALUES (1);
94
--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
95
--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1)
96
--let $statement_file=INSERT INTO t1 SELECT t2.a FROM t2 ORDER BY t2.a ON DUPLICATE KEY UPDATE t1.a= t1.a
97
--disable_warnings ONCE
98
--eval $statement_file
100
--let $assert_cond= SUM(a) = 1 FROM t1
101
--let $assert_text= Sum of elements in t1 should be 1.
102
--source include/assert.inc
104
if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`)
106
--let $binlog_position_cmp= =
107
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start
108
--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.
110
if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`)
112
--let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\'
113
--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.
115
--source include/assert.inc
74
119
--connection master