~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

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

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Test of replicating user variables
 
3
#
 
4
###########################################################
 
5
# 2006-02-08 By JBM added order by for use w/ NDB engine
 
6
###########################################################
 
7
source include/master-slave.inc;
 
8
 
 
9
#save_master_pos;
 
10
#connection slave;
 
11
#sync_with_master;
 
12
#reset master;
 
13
#connection master;
 
14
 
 
15
--disable_warnings
 
16
drop table if exists t1;
 
17
--enable_warnings
 
18
 
 
19
create table t1(n char(30));
 
20
 
 
21
prepare stmt1 from 'insert into t1 values (?)';
 
22
set @var1= "from-master-1";
 
23
execute stmt1 using @var1;
 
24
set @var1= "from-master-2-'',";
 
25
execute stmt1 using @var1;
 
26
SELECT * FROM t1 ORDER BY n;
 
27
 
 
28
set @var2= 'insert into t1 values (concat("from-var-", ?))';
 
29
prepare stmt2 from @var2;
 
30
set @var1='from-master-3';
 
31
execute stmt2 using @var1;
 
32
 
 
33
save_master_pos;
 
34
connection slave;
 
35
sync_with_master;
 
36
SELECT * FROM t1 ORDER BY n;
 
37
 
 
38
connection master;
 
39
 
 
40
drop table t1;
 
41
 
 
42
save_master_pos;
 
43
connection slave;
 
44
sync_with_master;
 
45
stop slave;
 
46
 
 
47
# End of 4.1 tests
 
48
 
 
49
#
 
50
# Bug #25843 Changing default database between PREPARE and EXECUTE of statement
 
51
# breaks binlog.
 
52
#
 
53
# There were actually two problems discovered by this bug:
 
54
#
 
55
#   1. Default (current) database is not fixed at the creation time.
 
56
#      That leads to wrong output of DATABASE() function.
 
57
#
 
58
#   2. Database attributes (@@collation_database) are not fixed at the creation
 
59
#      time. That leads to wrong resultset.
 
60
#
 
61
# Binlog breakage and Query Cache wrong output happened because of the first
 
62
# problem.
 
63
#
 
64
 
 
65
--echo
 
66
--echo ########################################################################
 
67
--echo #
 
68
--echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
 
69
--echo # statement breaks binlog.
 
70
--echo #
 
71
--echo ########################################################################
 
72
 
 
73
###############################################################################
 
74
 
 
75
--echo
 
76
--echo # Connection: slave
 
77
--echo
 
78
--connection slave
 
79
 
 
80
--echo
 
81
START SLAVE;
 
82
 
 
83
--echo
 
84
--echo # Connection: master
 
85
--echo
 
86
--connection master
 
87
 
 
88
--echo
 
89
CREATE DATABASE mysqltest1;
 
90
CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
 
91
 
 
92
--echo
 
93
PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
 
94
 
 
95
--echo
 
96
EXECUTE stmt_d_1;
 
97
 
 
98
--echo
 
99
use mysqltest1;
 
100
 
 
101
--echo
 
102
EXECUTE stmt_d_1;
 
103
 
 
104
--echo
 
105
--save_master_pos
 
106
 
 
107
--echo
 
108
--echo # Connection: slave
 
109
--echo
 
110
--connection slave
 
111
--sync_with_master
 
112
 
 
113
--echo
 
114
SELECT * FROM t1;
 
115
 
 
116
--echo
 
117
--echo # Connection: master
 
118
--echo
 
119
--connection master
 
120
 
 
121
--echo
 
122
DROP DATABASE mysqltest1;
 
123
 
 
124
--echo
 
125
use test;
 
126
 
 
127
--echo
 
128
--save_master_pos
 
129
 
 
130
--echo
 
131
--echo # Connection: slave
 
132
--echo
 
133
--connection slave
 
134
--sync_with_master
 
135
 
 
136
--echo
 
137
STOP SLAVE;
 
138
 
 
139
--echo
 
140
--echo ########################################################################
 
141
 
 
142
###############################################################################
 
143
 
 
144
reset master;
 
145
reset slave;
 
146
disconnect master;