2 -- source include/master-slave.inc
4 # Clean up old slave's binlogs.
5 # The slave is started with --log-slave-updates
6 # and this test does SHOW BINLOG EVENTS on the slave's
7 # binlog. But previous tests can influence the current test's
8 # binlog (e.g. a temporary table in the previous test has not
9 # been explicitly deleted, or it has but the slave hasn't had
10 # enough time to catch it before STOP SLAVE,
11 # and at the beginning of the current
12 # test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
13 # We wait for the slave to have written all he wants to the binlog
14 # (otherwise RESET MASTER may come too early).
21 connect (con1,localhost,root,,);
25 CREATE USER ''@localhost;
27 connect (con2,localhost,root,,);
28 # We want to connect as an unprivileged user. But if we use user="" then this
29 # will pick the Unix login, which will cause problems if you're running the test
31 connect (con3,localhost,zedjzlcsjhd,,);
33 # We are going to use SET PSEUDO_THREAD_ID in this test;
34 # check that it requires the SUPER privilege.
37 SET @save_select_limit=@@session.sql_select_limit;
39 SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
40 SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
41 # While we are here we also test that SQL_LOG_BIN can't be set
43 SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
44 SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
45 # Now as root, to be sure it works
47 SET @@session.pseudo_thread_id=100;
48 SET @@session.pseudo_thread_id=connection_id();
49 SET @@session.sql_log_bin=0;
50 SET @@session.sql_log_bin=1;
53 let $VERSION=`select version()`;
56 drop table if exists t1,t2;
59 create table t1(f int);
60 create table t2(f int);
61 insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
64 create temporary table t3(f int);
65 insert into t3 select * from t1 where f<6;
69 create temporary table t3(f int);
73 insert into t2 select count(*) from t3;
77 insert into t3 select * from t1 where f>=4;
81 drop temporary table t3;
85 insert into t2 select count(*) from t3;
86 drop temporary table t3;
88 select * from t2 ORDER BY f;
90 # Commented out 8/30/2005 to make compatable with both sbr and rbr
91 #--replace_result $VERSION VERSION
92 #--replace_column 2 # 5 #
98 SET TIMESTAMP=1040323920;
99 create table t1(f int);
100 SET TIMESTAMP=1040323931;
101 create table t2(f int);
102 SET TIMESTAMP=1040323938;
103 insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
105 SET TIMESTAMP=1040323945;
106 SET @@session.pseudo_thread_id=1;
107 create temporary table t3(f int);
108 SET TIMESTAMP=1040323952;
109 SET @@session.pseudo_thread_id=1;
110 insert into t3 select * from t1 where f<6;
111 SET TIMESTAMP=1040324145;
112 SET @@session.pseudo_thread_id=2;
113 create temporary table t3(f int);
114 SET TIMESTAMP=1040324186;
115 SET @@session.pseudo_thread_id=1;
116 insert into t2 select count(*) from t3;
117 SET TIMESTAMP=1040324200;
118 SET @@session.pseudo_thread_id=2;
119 insert into t3 select * from t1 where f>=4;
120 SET TIMESTAMP=1040324211;
121 SET @@session.pseudo_thread_id=1;
122 drop temporary table t3;
123 SET TIMESTAMP=1040324219;
124 SET @@session.pseudo_thread_id=2;
125 insert into t2 select count(*) from t3;
126 SET TIMESTAMP=1040324224;
127 SET @@session.pseudo_thread_id=2;
128 drop temporary table t3;
130 select * from t2 ORDER BY f;
133 # Create last a temporary table that is not dropped at end to ensure that we
134 # don't get any memory leaks for this
136 create temporary table t3 (f int);
139 # The server will now close done
142 # Bug#17284 erroneous temp table cleanup on slave
146 create temporary table t4 (f int);
147 create table t5 (f int);
150 select id from information_schema.processlist where command='Binlog Dump' into @id;
151 kill @id; # to stimulate reconnection by slave w/o timeout
152 insert into t5 select * from t4;
157 select * from t5 /* must be 1 after reconnection */;
160 drop temporary table t4;
164 # BUG#17263 incorrect generation DROP temp tables
165 # Temporary tables of connection are dropped in batches
166 # where a batch correspond to pseudo_thread_id
167 # value was set up at the moment of temp table creation
170 set @@session.pseudo_thread_id=100;
171 create temporary table t101 (id int);
172 create temporary table t102 (id int);
173 set @@session.pseudo_thread_id=200;
174 create temporary table t201 (id int);
175 create temporary table `t``201` (id int);
176 # emulate internal temp table not to come to binlog
177 create temporary table `#sql_not_user_table202` (id int);
178 set @@session.pseudo_thread_id=300;
179 create temporary table t301 (id int);
180 create temporary table t302 (id int);
181 create temporary table `#sql_not_user_table303` (id int);
185 DROP USER ''@localhost;
189 #now do something to show that slave is ok after DROP temp tables
191 create table t1(f int);
192 insert into t1 values (1);
194 sync_slave_with_master;
196 select * from t1 /* must be 1 */;
202 #14157: utf8 encoding in binlog without set character_set_client
204 exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test -e "create table t1 (a int); set names latin1; create temporary table äöüÄÖÜ (a int); insert into äöüÄÖÜ values (1); insert into t1 select * from äöüÄÖÜ";
206 sync_slave_with_master;