~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_known_bugs_detection.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Test to see if slave can detect certain known bugs present
 
2
# on the master, and appropriately decides to stop
 
3
# (assuming the bug is fixed in the slave, slave cannot of course
 
4
# imitate the bug, so it has to stop).
 
5
 
 
6
source include/have_debug.inc;
 
7
source include/master-slave.inc;
 
8
 
 
9
# Currently only statement-based-specific bugs are here
 
10
-- source include/have_binlog_format_mixed_or_statement.inc
 
11
 
 
12
#
 
13
# This is to test that slave properly detects if
 
14
# master may suffer from:
 
15
# BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
 
16
# (i.e. on master, INSERT ON DUPLICATE KEY UPDATE is used and manipulates
 
17
# an auto_increment column, and is binlogged statement-based).
 
18
#
 
19
 
 
20
# testcase with INSERT VALUES
 
21
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
 
22
UNIQUE(b));
 
23
sync_slave_with_master;
 
24
connection master;
 
25
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
 
26
SELECT * FROM t1;
 
27
connection slave;
 
28
--source include/wait_for_slave_sql_to_stop.inc
 
29
# show the error message
 
30
--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
 
31
--query_vertical show slave status;
 
32
# show that it was not replicated
 
33
SELECT * FROM t1;
 
34
 
 
35
# restart replication for the next testcase
 
36
stop slave;
 
37
reset slave;
 
38
connection master;
 
39
reset master;
 
40
drop table t1;
 
41
connection slave;
 
42
start slave;
 
43
 
 
44
# testcase with INSERT SELECT
 
45
connection master;
 
46
CREATE TABLE t1 (
 
47
  id bigint(20) unsigned NOT NULL auto_increment,
 
48
  field_1 int(10) unsigned NOT NULL,
 
49
  field_2 varchar(255) NOT NULL,
 
50
  field_3 varchar(255) NOT NULL,
 
51
  PRIMARY KEY (id),
 
52
  UNIQUE KEY field_1 (field_1, field_2)
 
53
);
 
54
CREATE TABLE t2 (
 
55
  field_a int(10) unsigned NOT NULL,
 
56
  field_b varchar(255) NOT NULL,
 
57
  field_c varchar(255) NOT NULL
 
58
);
 
59
INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
 
60
INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
 
61
INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
 
62
INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
 
63
INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
 
64
sync_slave_with_master;
 
65
connection master;
 
66
# Updating table t1 based on values from table t2
 
67
INSERT INTO t1 (field_1, field_2, field_3)
 
68
SELECT t2.field_a, t2.field_b, t2.field_c
 
69
FROM t2
 
70
ON DUPLICATE KEY UPDATE
 
71
t1.field_3 = t2.field_c;
 
72
# Inserting new record into t2
 
73
INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
 
74
# Updating t1 again
 
75
INSERT INTO t1 (field_1, field_2, field_3)
 
76
SELECT t2.field_a, t2.field_b, t2.field_c
 
77
FROM t2
 
78
ON DUPLICATE KEY UPDATE
 
79
t1.field_3 = t2.field_c;
 
80
SELECT * FROM t1;
 
81
connection slave;
 
82
--source include/wait_for_slave_sql_to_stop.inc
 
83
# show the error message
 
84
--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
 
85
--query_vertical show slave status;
 
86
# show that it was not replicated
 
87
SELECT * FROM t1;
 
88
connection master;
 
89
drop table t1, t2;
 
90
connection slave;
 
91
drop table t1, t2;
 
92
 
 
93
# End of 5.0 tests