~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Mathias Gug
  • Date: 2009-08-05 11:40:21 UTC
  • mfrom: (1.1.3 upstream) (0.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20090805114021-59bj0bgfm2ufllbk
Tags: 5.1.37-1ubuntu1
[ Mathias Gug ]
* Merge from debian unstable and 5.0, remaining changes:
  - debian/control:
    + Properly upgrade libmysqlclient16-dev packages to
    libmysqlclient-dev:
      * Make libmysqlclient16-dev a transitional package depending on
        libmysqlclient-dev.
      * Make libmysqlclient-dev replace libmysqlclient16-dev.
    + Don't provide a libmysqlclient15-dev package as long as there are
      packages still build-depending on libmysqlclient15-dev and
      mysql-dsfg-5.0 is in the archive.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.1.files: install apparmor profile.
    - debian/mysql-server-5.1.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.1.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
* debian/libmysqlclient16.symbols.amd64: remove amd64 symbols as it has
  not been correctly generated in Debian.
* Add Apport hook: (LP: #354188)
  - debian/mysql-server-5.1.py: apport package hook.
  - debian/mysql-server-5.1.files, debian/rules: install apport package
    hook.
* debian/additions/my.cnf: 
  - drop old_password option.
  - fix commented logging options to use general_log and general_log_file.
* Dropped - accepted in Debian:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ==== Purpose ====
 
2
#
 
3
# This test check if DDL statements are correctly binlogged when the
 
4
# thread is killed
 
5
#
 
6
# ==== Method ====
 
7
#
 
8
# Start a DDL query and kill it, check if the error code of the binlog
 
9
# event is correct.
 
10
#
 
11
# DDL statements tested:
 
12
# CREATE/ALTER/RENAME/DROP DATABASE
 
13
# CREATE/ALTER/DROP        EVENT
 
14
# CREATE/ALTER/DROP        FUNCTION
 
15
# CREATE/ALTER/DROP        PROCEDURE
 
16
# CREATE/ALTER/DROP        SERVER
 
17
# CREATE/ALTER/RENAME/DROP TABLE
 
18
# CREATE/DROP              TRIGGER
 
19
# CREATE/ALTER/DROP        VIEW
 
20
#
 
21
# ==== Bugs =====
 
22
#
 
23
# BUG#37145
 
24
#
 
25
# ==== TODO ====
 
26
#
 
27
# There are some part of the test are temporarily disabled because of
 
28
# the following bugs, please enable then once they get fixed:
 
29
#  - BUG#44041
 
30
#  - BUG#43353
 
31
#  - BUG#25705
 
32
#  - BUG#44171
 
33
 
 
34
source include/have_debug.inc;
 
35
source include/master-slave.inc;
 
36
 
 
37
# Use the DBUG_SYNC_POINT to make sure the thread running the DDL is
 
38
# waiting before creating the query log event
 
39
 
 
40
let $debug_lock= "debug_lock.before_query_log_event";
 
41
 
 
42
######## INITIALIZATION ########
 
43
 
 
44
disable_warnings;
 
45
DROP DATABASE IF EXISTS d1;
 
46
DROP DATABASE IF EXISTS d2;
 
47
DROP DATABASE IF EXISTS d3;
 
48
DROP DATABASE IF EXISTS d4;
 
49
DROP EVENT IF EXISTS e1;
 
50
DROP EVENT IF EXISTS e2;
 
51
DROP EVENT IF EXISTS e3;
 
52
DROP EVENT IF EXISTS e4;
 
53
DROP FUNCTION IF EXISTS f1;
 
54
DROP FUNCTION IF EXISTS f2;
 
55
DROP FUNCTION IF EXISTS f3;
 
56
DROP FUNCTION IF EXISTS f4;
 
57
DROP SERVER IF EXISTS s1;
 
58
DROP SERVER IF EXISTS s2;
 
59
DROP SERVER IF EXISTS s3;
 
60
DROP SERVER IF EXISTS s4;
 
61
DROP TABLE IF EXISTS t1;
 
62
DROP TABLE IF EXISTS t2;
 
63
DROP TABLE IF EXISTS t3;
 
64
DROP TABLE IF EXISTS t4;
 
65
DROP PROCEDURE IF EXISTS p1;
 
66
DROP PROCEDURE IF EXISTS p2;
 
67
DROP PROCEDURE IF EXISTS p3;
 
68
DROP PROCEDURE IF EXISTS p4;
 
69
DROP TRIGGER IF EXISTS tr1;
 
70
DROP TRIGGER IF EXISTS tr2;
 
71
DROP TRIGGER IF EXISTS tr3;
 
72
DROP TRIGGER IF EXISTS tr4;
 
73
enable_warnings;
 
74
 
 
75
CREATE DATABASE d1;
 
76
 
 
77
CREATE EVENT e1
 
78
  ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
 
79
  DO INSERT INTO test.t1 VALUES (1);
 
80
 
 
81
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
 
82
    RETURN 1;
 
83
 
 
84
DELIMITER //;
 
85
CREATE PROCEDURE p1 (OUT rows INT)
 
86
    BEGIN
 
87
        SELECT COUNT(*) INTO rows FROM t1;
 
88
    END;
 
89
    //
 
90
DELIMITER ;//
 
91
 
 
92
CREATE SERVER s1
 
93
FOREIGN DATA WRAPPER mysql
 
94
OPTIONS (USER 'user1', HOST '192.168.1.106', DATABASE 'test');
 
95
 
 
96
CREATE TABLE t1 (a int);
 
97
CREATE TABLE t3 (a int);
 
98
 
 
99
DELIMITER //;
 
100
CREATE TRIGGER tr1 BEFORE INSERT ON t1
 
101
    FOR EACH ROW BEGIN
 
102
        DELETE FROM t4 WHERE a=NEW.a;
 
103
    END;
 
104
    //
 
105
DELIMITER ;//
 
106
 
 
107
CREATE INDEX i1 ON t1 (a);
 
108
 
 
109
CREATE VIEW v1 AS SELECT a FROM t1 WHERE a < 100;
 
110
 
 
111
sync_slave_with_master;
 
112
 
 
113
connection master1;
 
114
let $connection_name= master1;
 
115
let $connection_id= `SELECT CONNECTION_ID()`;
 
116
 
 
117
connection master;
 
118
echo [on master];
 
119
 
 
120
# This will block the execution of a statement at the DBUG_SYNC_POINT
 
121
# with given lock name
 
122
if (`SELECT '$debug_lock' != ''`)
 
123
{
 
124
  disable_query_log;
 
125
  disable_result_log;
 
126
  eval SELECT IS_FREE_LOCK($debug_lock);
 
127
  eval SELECT GET_LOCK($debug_lock, 10);
 
128
  eval SELECT IS_FREE_LOCK($debug_lock);
 
129
  enable_query_log;
 
130
  enable_result_log;
 
131
}
 
132
 
 
133
######## START TEST ########
 
134
 
 
135
connection master1;
 
136
echo [on master1];
 
137
 
 
138
disable_warnings;
 
139
 
 
140
######## DATABASE ########
 
141
 
 
142
let $diff_statement= SHOW DATABASES LIKE 'd%';
 
143
 
 
144
send CREATE DATABASE d2;
 
145
source include/kill_query_and_diff_master_slave.inc;
 
146
 
 
147
# Temporarily disabled, see BUG#44041, the ALTER DATABASE can affect the
 
148
# collation of other database on slave
 
149
#send ALTER DATABASE d1
 
150
#       DEFAULT CHARACTER SET = 'utf8';
 
151
#source include/kill_query_and_diff_master_slave.inc;
 
152
 
 
153
send DROP DATABASE d1;
 
154
source include/kill_query_and_diff_master_slave.inc;
 
155
 
 
156
send DROP DATABASE d2;
 
157
source include/kill_query_and_diff_master_slave.inc;
 
158
 
 
159
######## EVENT ########
 
160
 
 
161
let $diff_statement= SELECT event_name, event_body, execute_at
 
162
                     FROM information_schema.events where event_name like 'e%';
 
163
 
 
164
send CREATE EVENT e2
 
165
  ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
 
166
  DO INSERT INTO test.t1 VALUES (2);
 
167
source include/kill_query_and_diff_master_slave.inc;
 
168
 
 
169
# Temporarily disabled because of BUG#44171, killing ALTER EVENT can
 
170
# crash the server
 
171
#send ALTER EVENT e1
 
172
#  ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 2 DAY;
 
173
#source include/kill_query_and_diff_master_slave.inc;
 
174
 
 
175
send DROP EVENT e1;
 
176
source include/kill_query_and_diff_master_slave.inc;
 
177
 
 
178
send DROP EVENT IF EXISTS e2;
 
179
source include/kill_query_and_diff_master_slave.inc;
 
180
 
 
181
######## FUNCTION ########
 
182
 
 
183
let $diff_statement= SHOW FUNCTION STATUS LIKE 'f%';
 
184
 
 
185
send CREATE FUNCTION f2 () RETURNS INT DETERMINISTIC
 
186
     RETURN 1;
 
187
source include/kill_query_and_diff_master_slave.inc;
 
188
 
 
189
send ALTER FUNCTION f1 SQL SECURITY INVOKER;
 
190
source include/kill_query_and_diff_master_slave.inc;
 
191
 
 
192
# function f1 probably does not exist because the ALTER query was
 
193
# killed
 
194
send DROP FUNCTION f1;
 
195
source include/kill_query_and_diff_master_slave.inc;
 
196
 
 
197
# function f2 probably does not exist because the CREATE query was
 
198
# killed
 
199
#
 
200
# Temporarily disabled. Because of BUG#43353, KILL the query may
 
201
# result in function not found, and for 5.1, DROP statements will be
 
202
# logged if the function is not found on master, so the following DROP
 
203
# FUNCTION statement may be interrupted and not drop the function on
 
204
# master, but still get logged and executed on slave and cause
 
205
# inconsistence. Also disable the following DROP PROCEDURE IF EXITS
 
206
# below.
 
207
#send DROP FUNCTION IF EXISTS f2;
 
208
#source include/kill_query_and_diff_master_slave.inc;
 
209
 
 
210
######## PROCEDURE ########
 
211
 
 
212
let $diff_statement= SHOW PROCEDURE STATUS LIKE 'p%';
 
213
 
 
214
DELIMITER //;
 
215
send CREATE PROCEDURE p2 (OUT rows INT)
 
216
     BEGIN
 
217
       SELECT COUNT(*) INTO rows FROM t2;
 
218
     END;
 
219
     //
 
220
DELIMITER ;//
 
221
source include/kill_query_and_diff_master_slave.inc;
 
222
 
 
223
send ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1';
 
224
source include/kill_query_and_diff_master_slave.inc;
 
225
 
 
226
send DROP PROCEDURE p1;
 
227
source include/kill_query_and_diff_master_slave.inc;
 
228
 
 
229
# Temporarily disabled, see comment above for DROP FUNCTION IF EXISTS
 
230
#send DROP PROCEDURE IF EXISTS p2;
 
231
#source include/kill_query_and_diff_master_slave.inc;
 
232
 
 
233
######## TABLE ########
 
234
 
 
235
let $diff_statement= SHOW TABLES LIKE 't%';
 
236
 
 
237
send CREATE TABLE t2 (b int);
 
238
source include/kill_query_and_diff_master_slave.inc;
 
239
 
 
240
send ALTER TABLE t1 ADD (d int);
 
241
source include/kill_query_and_diff_master_slave.inc;
 
242
 
 
243
send RENAME TABLE t3 TO t4;
 
244
source include/kill_query_and_diff_master_slave.inc;
 
245
 
 
246
######## INDEX ########
 
247
 
 
248
let $diff_statement= SHOW INDEX FROM t1;
 
249
 
 
250
send CREATE INDEX i2 on t1 (a);
 
251
source include/kill_query_and_diff_master_slave.inc;
 
252
 
 
253
send DROP INDEX i1 on t1;
 
254
source include/kill_query_and_diff_master_slave.inc;
 
255
 
 
256
 
 
257
######## SERVER ########
 
258
 
 
259
# Tempoarily disabled, see bug#25705
 
260
 
 
261
# let $diff_statement= SELECT * FROM mysql.server WHERE name like 's%';
 
262
 
 
263
# send CREATE SERVER s2
 
264
#     FOREIGN DATA WRAPPER mysql
 
265
#     OPTIONS (USER 'user2', HOST '192.168.1.108', DATABASE 'test');
 
266
# source include/kill_query_and_diff_master_slave.inc;
 
267
    
 
268
# send ALTER SERVER s1
 
269
#     OPTIONS (DATABASE 'test1');
 
270
# source include/kill_query_and_diff_master_slave.inc;
 
271
 
 
272
# send DROP SERVER s1;
 
273
# source include/kill_query_and_diff_master_slave.inc;
 
274
 
 
275
# send DROP SERVER IF EXIST s1;
 
276
# source include/kill_query_and_diff_master_slave.inc;
 
277
 
 
278
######## TRIGGER ########
 
279
 
 
280
let $diff_statement= SHOW TRIGGERS LIKE 'v%';
 
281
 
 
282
DELIMITER //;
 
283
send CREATE TRIGGER tr2 BEFORE INSERT ON t4
 
284
       FOR EACH ROW BEGIN
 
285
         DELETE FROM t1 WHERE a=NEW.a;
 
286
       END;
 
287
       //
 
288
DELIMITER ;//
 
289
source include/kill_query_and_diff_master_slave.inc;
 
290
 
 
291
send DROP TRIGGER tr1;
 
292
source include/kill_query_and_diff_master_slave.inc;
 
293
 
 
294
send DROP TRIGGER IF EXISTS tr2;
 
295
source include/kill_query_and_diff_master_slave.inc;
 
296
 
 
297
######## VIEW ########
 
298
 
 
299
let $diff_statement= SHOW TABLES LIKE 'v%';
 
300
 
 
301
send CREATE VIEW v2 AS SELECT a FROM t1 WHERE a > 100;
 
302
source include/kill_query_and_diff_master_slave.inc;
 
303
 
 
304
send DROP VIEW v1;
 
305
source include/kill_query_and_diff_master_slave.inc;
 
306
 
 
307
send DROP VIEW IF EXISTS v2;
 
308
source include/kill_query_and_diff_master_slave.inc;
 
309
 
 
310
######## DROP TABLE ########
 
311
 
 
312
let $diff_statement= SHOW TABLES LIKE 't%';
 
313
 
 
314
send DROP TABLE t1;
 
315
source include/kill_query_and_diff_master_slave.inc;
 
316
 
 
317
send DROP TABLE IF EXISTS t2;
 
318
source include/kill_query_and_diff_master_slave.inc;
 
319
 
 
320
######## CLEAN UP ########
 
321
 
 
322
connection master;
 
323
 
 
324
# The DROP statements above are killed during the process, so they
 
325
# does not make sure the objects are dropped.
 
326
 
 
327
disable_warnings;
 
328
DROP DATABASE IF EXISTS d1;
 
329
DROP DATABASE IF EXISTS d2;
 
330
DROP DATABASE IF EXISTS d3;
 
331
DROP DATABASE IF EXISTS d4;
 
332
DROP EVENT IF EXISTS e1;
 
333
DROP EVENT IF EXISTS e2;
 
334
DROP EVENT IF EXISTS e3;
 
335
DROP EVENT IF EXISTS e4;
 
336
DROP FUNCTION IF EXISTS f1;
 
337
DROP FUNCTION IF EXISTS f2;
 
338
DROP FUNCTION IF EXISTS f3;
 
339
DROP FUNCTION IF EXISTS f4;
 
340
DROP SERVER IF EXISTS s1;
 
341
DROP SERVER IF EXISTS s2;
 
342
DROP SERVER IF EXISTS s3;
 
343
DROP SERVER IF EXISTS s4;
 
344
DROP TABLE IF EXISTS t1;
 
345
DROP TABLE IF EXISTS t2;
 
346
DROP TABLE IF EXISTS t3;
 
347
DROP TABLE IF EXISTS t4;
 
348
DROP PROCEDURE IF EXISTS p1;
 
349
DROP PROCEDURE IF EXISTS p2;
 
350
DROP PROCEDURE IF EXISTS p3;
 
351
DROP PROCEDURE IF EXISTS p4;
 
352
enable_warnings;