1#
2# BUG
3# ---
4#  BUG#39753: Replication failure on MIXED + bit + myisam + no PK
5#
6# Description
7# -----------
8#  Simple statements against a bit column cause failure in mixed-mode
9#  replication.
10#
11#  Implementation is as follows:
12#     i) A table with two bit fields is created. One of them is a key.
13#    ii) A record is inserted without specifying the key value.
14#   iii) The record is deleted using a where clause that matches it.
15#    iv) repeat i-iii) for bit key that has different size, generating
16#        different extra bits values
17#     v) The slave is synchronized with master
18#    vi) The table is dropped on master and the slave is re-synchronized
19#        with master.
20#
21#  Step v) made the bug evident before the patch, as the slave would
22#  fail to find the correspondent row in its database (although it did
23#  the insert in step ii) ).
24#
25# Obs
26# ---
27#  This test is based on the "how to repeat" section from the bug report.
28#
29#
30
31--source include/master-slave.inc
32
33disable_query_log;
34call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
35enable_query_log;
36
37--disable_warnings
38# setup
39
40DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
41CREATE TABLE t1 (`bit_key` bit, `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
42CREATE TABLE t2 (`bit_key` bit(4), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
43CREATE TABLE t3 (`bit_key` bit(7), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
44CREATE TABLE t4 (`bit_key` bit(8), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
45CREATE TABLE t5 (`bit_key` bit(9), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
46CREATE TABLE t6 (`bit_key` bit(14), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
47CREATE TABLE t7 (`bit_key` bit(15), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
48CREATE TABLE t8 (`bit_key` bit(16), `bit` bit, key (`bit_key` )) ENGINE=MyISAM;
49
50# insert and delete
51INSERT INTO `t1` ( `bit` ) VALUES ( 0 );
52DELETE FROM `t1` WHERE `bit` < 2 LIMIT 4;
53
54INSERT INTO `t2` ( `bit` ) VALUES ( 0 );
55DELETE FROM `t2` WHERE `bit` < 2 LIMIT 4;
56
57INSERT INTO `t3` ( `bit` ) VALUES ( 0 );
58DELETE FROM `t3` WHERE `bit` < 2 LIMIT 4;
59
60INSERT INTO `t4` ( `bit` ) VALUES ( 0 );
61DELETE FROM `t4` WHERE `bit` < 2 LIMIT 4;
62
63INSERT INTO `t5` ( `bit` ) VALUES ( 0 );
64DELETE FROM `t5` WHERE `bit` < 2 LIMIT 4;
65
66INSERT INTO `t6` ( `bit` ) VALUES ( 0 );
67DELETE FROM `t6` WHERE `bit` < 2 LIMIT 4;
68
69INSERT INTO `t7` ( `bit` ) VALUES ( 0 );
70DELETE FROM `t7` WHERE `bit` < 2 LIMIT 4;
71
72INSERT INTO `t8` ( `bit` ) VALUES ( 0 );
73DELETE FROM `t8` WHERE `bit` < 2 LIMIT 4;
74
75
76--enable_warnings
77sync_slave_with_master;
78
79# clean up
80connection master;
81DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8;
82sync_slave_with_master;
83--source include/rpl_end.inc
84