1
by brian
clean slate |
1 |
# Test need anonymous user when connection are made as "zedjzlcsjhd" |
2 |
source include/add_anonymous_users.inc; |
|
3 |
||
4 |
-- source include/master-slave.inc
|
|
5 |
||
6 |
# Clean up old slave's binlogs. |
|
7 |
# The slave is started with --log-slave-updates
|
|
8 |
# and this test does SHOW BINLOG EVENTS on the slave's |
|
9 |
# binlog. But previous tests can influence the current test's |
|
10 |
# binlog (e.g. a temporary table in the previous test has not
|
|
11 |
# been explicitly deleted, or it has but the slave hasn't had |
|
12 |
# enough time to catch it before STOP SLAVE, |
|
13 |
# and at the beginning of the current |
|
14 |
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table). |
|
15 |
# We wait for the slave to have written all he wants to the binlog |
|
16 |
# (otherwise RESET MASTER may come too early). |
|
17 |
save_master_pos; |
|
18 |
connection slave; |
|
19 |
sync_with_master; |
|
20 |
reset master; |
|
21 |
connection master; |
|
22 |
||
23 |
connect (con1,localhost,root,,); |
|
24 |
connect (con2,localhost,root,,); |
|
25 |
# We want to connect as an unprivileged user. But if we use user="" then this |
|
26 |
# will pick the Unix login, which will cause problems if you're running the test |
|
27 |
# as root.
|
|
28 |
connect (con3,localhost,zedjzlcsjhd,,);
|
|
29 |
||
30 |
# We are going to use SET PSEUDO_THREAD_ID in this test;
|
|
31 |
# check that it requires the SUPER privilege.
|
|
32 |
||
33 |
connection con3;
|
|
34 |
SET @save_select_limit=@@session.sql_select_limit;
|
|
35 |
--error 1227
|
|
36 |
SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
|
|
37 |
SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed |
|
38 |
# While we are here we also test that SQL_LOG_BIN can't be set |
|
39 |
--error 1227
|
|
40 |
SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
|
|
41 |
SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed |
|
42 |
# Now as root, to be sure it works |
|
43 |
connection con2; |
|
44 |
SET @@session.pseudo_thread_id=100; |
|
45 |
SET @@session.pseudo_thread_id=connection_id(); |
|
46 |
SET @@session.sql_log_bin=0; |
|
47 |
SET @@session.sql_log_bin=1; |
|
48 |
||
49 |
connection con3; |
|
50 |
let $VERSION=`select version()`; |
|
51 |
||
52 |
--disable_warnings
|
|
53 |
drop table if exists t1,t2; |
|
54 |
--enable_warnings
|
|
55 |
||
56 |
create table t1(f int); |
|
57 |
create table t2(f int); |
|
58 |
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
|
59 |
||
60 |
connection con1; |
|
61 |
create temporary table t3(f int); |
|
62 |
insert into t3 select * from t1 where f<6; |
|
63 |
let $wait_condition= SELECT COUNT(*) = 5 FROM t3; |
|
64 |
--source include/wait_condition.inc
|
|
65 |
||
66 |
connection con2; |
|
67 |
create temporary table t3(f int); |
|
68 |
||
69 |
connection con1; |
|
70 |
insert into t2 select count(*) from t3; |
|
71 |
let $wait_condition= SELECT COUNT(*) = 1 FROM t2; |
|
72 |
--source include/wait_condition.inc
|
|
73 |
||
74 |
connection con2; |
|
75 |
insert into t3 select * from t1 where f>=4; |
|
76 |
let $wait_condition= SELECT COUNT(*) = 7 FROM t3; |
|
77 |
--source include/wait_condition.inc
|
|
78 |
||
79 |
connection con1; |
|
80 |
drop temporary table t3; |
|
81 |
||
82 |
connection con2; |
|
83 |
insert into t2 select count(*) from t3; |
|
84 |
drop temporary table t3; |
|
85 |
||
86 |
select * from t2 ORDER BY f; |
|
87 |
||
88 |
# Commented out 8/30/2005 to make compatable with both sbr and rbr |
|
89 |
#--replace_result $VERSION VERSION |
|
90 |
#--replace_column 2 # 5 # |
|
91 |
#show binlog events; |
|
92 |
||
93 |
drop table t1, t2; |
|
94 |
||
95 |
use test; |
|
96 |
SET TIMESTAMP=1040323920; |
|
97 |
create table t1(f int); |
|
98 |
SET TIMESTAMP=1040323931; |
|
99 |
create table t2(f int); |
|
100 |
SET TIMESTAMP=1040323938; |
|
101 |
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
|
102 |
||
103 |
SET TIMESTAMP=1040323945; |
|
104 |
SET @@session.pseudo_thread_id=1; |
|
105 |
create temporary table t3(f int); |
|
106 |
SET TIMESTAMP=1040323952; |
|
107 |
SET @@session.pseudo_thread_id=1; |
|
108 |
insert into t3 select * from t1 where f<6; |
|
109 |
SET TIMESTAMP=1040324145; |
|
110 |
SET @@session.pseudo_thread_id=2; |
|
111 |
create temporary table t3(f int); |
|
112 |
SET TIMESTAMP=1040324186; |
|
113 |
SET @@session.pseudo_thread_id=1; |
|
114 |
insert into t2 select count(*) from t3; |
|
115 |
SET TIMESTAMP=1040324200; |
|
116 |
SET @@session.pseudo_thread_id=2; |
|
117 |
insert into t3 select * from t1 where f>=4; |
|
118 |
SET TIMESTAMP=1040324211; |
|
119 |
SET @@session.pseudo_thread_id=1; |
|
120 |
drop temporary table t3; |
|
121 |
SET TIMESTAMP=1040324219; |
|
122 |
SET @@session.pseudo_thread_id=2; |
|
123 |
insert into t2 select count(*) from t3; |
|
124 |
SET TIMESTAMP=1040324224; |
|
125 |
SET @@session.pseudo_thread_id=2; |
|
126 |
drop temporary table t3; |
|
127 |
||
128 |
select * from t2 ORDER BY f; |
|
129 |
drop table t1,t2; |
|
130 |
||
131 |
# Create last a temporary table that is not dropped at end to ensure that we |
|
132 |
# don't get any memory leaks for this |
|
133 |
||
134 |
create temporary table t3 (f int);
|
|
135 |
sync_slave_with_master;
|
|
136 |
||
137 |
# The server will now close done
|
|
138 |
||
139 |
#
|
|
140 |
# Bug#17284 erroneous temp table cleanup on slave
|
|
141 |
#
|
|
142 |
||
143 |
connection master;
|
|
144 |
create temporary table t4 (f int);
|
|
145 |
create table t5 (f int);
|
|
146 |
sync_slave_with_master;
|
|
147 |
connection master;
|
|
148 |
# find dumper's $id |
|
149 |
select id from information_schema.processlist where command='Binlog Dump' into @id; |
|
150 |
kill @id; # to stimulate reconnection by slave w/o timeout |
|
151 |
insert into t5 select * from t4; |
|
152 |
save_master_pos; |
|
153 |
||
154 |
connection slave; |
|
155 |
sync_with_master; |
|
156 |
select * from t5 /* must be 1 after reconnection */; |
|
157 |
||
158 |
connection master; |
|
159 |
drop temporary table t4; |
|
160 |
drop table t5; |
|
161 |
||
162 |
#
|
|
163 |
# BUG#17263 incorrect generation DROP temp tables |
|
164 |
# Temporary tables of connection are dropped in batches |
|
165 |
# where a batch correspond to pseudo_thread_id |
|
166 |
# value was set up at the moment of temp table creation |
|
167 |
#
|
|
168 |
connection con1; |
|
169 |
set @@session.pseudo_thread_id=100; |
|
170 |
create temporary table t101 (id int); |
|
171 |
create temporary table t102 (id int); |
|
172 |
set @@session.pseudo_thread_id=200; |
|
173 |
create temporary table t201 (id int); |
|
174 |
create temporary table `t``201` (id int); |
|
175 |
# emulate internal temp table not to come to binlog |
|
176 |
create temporary table `#sql_not_user_table202` (id int); |
|
177 |
set @@session.pseudo_thread_id=300; |
|
178 |
create temporary table t301 (id int); |
|
179 |
create temporary table t302 (id int); |
|
180 |
create temporary table `#sql_not_user_table303` (id int); |
|
181 |
disconnect con1; |
|
182 |
||
183 |
#now do something to show that slave is ok after DROP temp tables |
|
184 |
connection master; |
|
185 |
create table t1(f int); |
|
186 |
insert into t1 values (1); |
|
187 |
||
188 |
sync_slave_with_master; |
|
189 |
#connection slave; |
|
190 |
select * from t1 /* must be 1 */; |
|
191 |
||
192 |
connection master; |
|
193 |
drop table t1; |
|
194 |
||
195 |
#
|
|
196 |
#14157: utf8 encoding in binlog without set character_set_client |
|
197 |
#
|
|
198 |
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
|
|
199 |
create table t1 (a int); |
|
200 |
set names latin1; |
|
201 |
create temporary table `äöüÄÖÜ` (a int); |
|
202 |
insert into `äöüÄÖÜ` values (1); |
|
203 |
insert into t1 select * from `äöüÄÖÜ` |
|
204 |
EOF
|
|
205 |
--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
|
|
206 |
||
207 |
sync_slave_with_master; |
|
208 |
#connection slave; |
|
209 |
select * from t1; |
|
210 |
||
211 |
connection master; |
|
212 |
drop table t1; |
|
213 |
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
|
|
214 |
||
215 |
# Delete the anonymous users |
|
216 |
source include/delete_anonymous_users.inc; |
|
217 |
||
218 |
# End of tests |