~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/extra/rpl_tests/rpl_ddl.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
################# extra/rpl_tests/rpl_ddl.test ########################
 
2
#                                                                     #
 
3
# DDL statements (sometimes with implicit COMMIT) and other stuff     #
 
4
# executed on the master and it's propagation into the slave.         #
 
5
#                                                                     #
 
6
# The variables                                                       #
 
7
#    $engine_type       -- storage engine to be tested/used for the   #
 
8
#                          permanent tables within the master         #
 
9
#    $temp_engine_type  -- storage engine which supports TEMPORARY    #
 
10
#                          tables <> $engine_type                     #
 
11
#                          $temp_engine_type must point to an all     #
 
12
#                          time available storage engine              #
 
13
#                          2007-02 MySQL 5.1 MyISAM and MEMORY only   #
 
14
#    $show_binlog       -- print binlog entries                       #
 
15
#                          0 - no (default) + fits to the file with   #
 
16
#                              results                                #
 
17
#                          1 - yes (important for debugging)          #
 
18
#                          This variable is used within               #
 
19
#                          include/rpl_stmt_seq.inc.                  #
 
20
#    $manipulate        -- Manipulation of the binary logs            #
 
21
#                          0 - do nothing                             #
 
22
#                          1 - so that the output of SHOW BINLOG      #
 
23
#                              EVENTS IN <current log> contains only  #
 
24
#                              commands of the current test sequence  #
 
25
#                              This is especially useful, if the      #
 
26
#                              $show_binlog is set to 1 and many      #
 
27
#                              subtest are executed.                  #
 
28
#                          This variable is used within               #
 
29
#                          include/rpl_stmt_seq.inc.                  #
 
30
# have to be set before sourcing this script.                         #
 
31
#                                                                     #
 
32
# General assumption about the ideal replication behaviour:           #
 
33
#    Whatever on the master is executed the content of the slave must #
 
34
#    be in sync with it.                                              #
 
35
#                                                                     #
 
36
#    Tests of special interest:                                       #
 
37
#    a) Which DDL commands cause an implicit COMMIT ?                 #
 
38
#       This is also of interest outside of replication.              #
 
39
#    b) Transactions modifying table content ending with              #
 
40
#       - explicit COMMIT or ROLLBACK                                 #
 
41
#       - implicit COMMIT because the connection to the master        #
 
42
#         executed a corresponding DDL statement or runs in           #
 
43
#         AUTOCOMMIT mode                                             #
 
44
#       - something similar to "implicit COMMIT" if the storage       #
 
45
#         engine (master) is not transactional                        #
 
46
#    c) Command which change no data like SELECT or SHOW              #
 
47
#       They do not change anything within the master but             #
 
48
#       this must be also valid for the slave.                        #
 
49
#                                                                     #
 
50
#######################################################################
 
51
 
 
52
# Last update:
 
53
# 2007-02-12 ML: - slave needs AUTOCOMMIT = 1, because we want to check only
 
54
#                  the propagation of actions of the master connection.
 
55
#                - replace comments via SQL by "--echo ..."
 
56
#                - remove some bugs within the testscripts
 
57
#                - remove the use of include/rpl_stmt_seq2.inc
 
58
#              
 
59
#
 
60
# NOTES:
 
61
# 2006-11-15 Lars: Matthias (ML) is the "owner" of this test case.
 
62
#                  So, please get him to review it whenever you want to
 
63
#                  do changes to it.
 
64
#
 
65
# PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
 
66
#
 
67
#    Typical test architecture (--> include/rpl_stmt_seq.inc)
 
68
#    --------------------------------------------------------
 
69
#    1. Master (no AUTOCOMMIT!): INSERT INTO mysqltest1.t1 without commit
 
70
#    2. Master and slave: Check the content of mysqltest1.t1
 
71
#    3. Master (no AUTOCOMMIT!): EXECUTE the statement to be tested
 
72
#    4. Master and slave: Check the content of mysqltest1.t1
 
73
#    5. Master (no AUTOCOMMIT!): ROLLBACK
 
74
#    6. Master and slave: Check the content of mysqltest1.t1
 
75
#       If the previous into mysqltest1.t1 inserted row is visible,
 
76
#       than the statement to be tested caused an explicit COMMIT
 
77
#       (statement = COMMIT) or an implicit COMMIT (example CREATE TABLE).
 
78
#       If the previous into mysqltest1.t1 inserted row is not visible,
 
79
#       than the statement to be tested caused either an explicit ROLLBACK
 
80
#       (statement = ROLLBACK), an implicit ROLLBACK (deadlock etc. but
 
81
#       not tested here) or it does not cause any transaction end. 
 
82
#    7. Flush the logs
 
83
#            
 
84
#    Some rules:
 
85
#    -----------
 
86
#    1. Any use of mysqltest1.t1 within the statement to be tested must be
 
87
#       avoided if possible. The only known exception is around LOCK TABLE.
 
88
#               
 
89
#    2. The test logics needs for
 
90
#           master connection: AUTOCOMMIT = 0
 
91
#           slave  connection: AUTOCOMMIT = 1
 
92
#       The master connection  is the actor and the slave connection is 
 
93
#       only an observer. I.e. the slave connection must not influence
 
94
#       the activities of master connection.
 
95
#
 
96
#    3. !All! objects to be dropped, renamed, altered ... must be created
 
97
#       before the tests start.
 
98
#       --> less switching of AUTOCOMMIT mode on master side.
 
99
#
 
100
#    4. Never use a test object, which was direct or indirect affected by a
 
101
#       preceeding test sequence again.
 
102
#       If one preceeding test sequence hits a (sometimes not visible,
 
103
#       because the sql error code of the statement might be 0) bug
 
104
#       and these rules are ignored, a following test sequence might earn ugly
 
105
#       effects like failing 'sync_slave_with_master', crashes of the slave or
 
106
#       abort of the test case etc.. This means during analysis the first look
 
107
#       points into a totally wrong area.
 
108
#       Except table mysqltest1.t1 where ONLY DML is allowed.
 
109
#
 
110
#    5. This file is used in several tests (t/rpl_ddl_<whatever>.test).
 
111
#         Please be aware that every change of the current file affects
 
112
#         the results of these tests.
 
113
#
 
114
# ML: Some maybe banal hints:
 
115
#     1. The fact that we have here a master - slave replication does
 
116
#        not cause that many general MySQL properties do not apply.
 
117
#        Example:
 
118
#        The connection to the slave is just a simple session and not a however
 
119
#        magic working "copy" of the master session or something similar.
 
120
#        - TEMPORARY TABLES and @variables are session specific
 
121
#        - the slave session cannot see these things of the master.
 
122
#     2. The slave connection must not call sync_slave_with_master.
 
123
#     3. SHOW STATUS SLAVE must be run within the slave connection.
 
124
#     4. Testcase analysis becomes much more comfortable if 
 
125
#        $show_binlog within include/rpl_stmt_seq.inc is set to 1.
 
126
#
 
127
 
 
128
###############################################################
 
129
# Some preparations
 
130
###############################################################
 
131
# The sync_slave_with_master is needed to make the xids deterministic.
 
132
sync_slave_with_master;
 
133
 
 
134
--echo
 
135
--echo -------- switch to master -------
 
136
connection master;
 
137
SET AUTOCOMMIT = 1;
 
138
#
 
139
# 1. DROP all objects, which probably already exist, but must be created here
 
140
#
 
141
--disable_warnings
 
142
DROP DATABASE IF EXISTS mysqltest1;
 
143
DROP DATABASE IF EXISTS mysqltest2;
 
144
DROP DATABASE IF EXISTS mysqltest3;
 
145
--enable_warnings
 
146
#
 
147
# 2. CREATE all objects needed
 
148
#    working database is mysqltest1
 
149
#    working table (transactional!) is mysqltest1.t1 
 
150
#
 
151
CREATE DATABASE mysqltest1;
 
152
CREATE DATABASE mysqltest2;
 
153
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
 
154
INSERT INTO mysqltest1.t1 SET f1= 0;
 
155
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
 
156
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
 
157
eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type;
 
158
eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type;
 
159
eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type;
 
160
CREATE INDEX my_idx6 ON mysqltest1.t6(f1);
 
161
eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type;
 
162
INSERT INTO mysqltest1.t7 SET f1= 0;
 
163
eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type;
 
164
eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type;
 
165
eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type;
 
166
eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type;
 
167
eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type;
 
168
eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type;
 
169
eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type;
 
170
eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type;
 
171
eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type;
 
172
eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type;
 
173
eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type;
 
174
eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type;
 
175
eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type;
 
176
 
 
177
#
 
178
# 3. master sessions: never do AUTOCOMMIT
 
179
#    slave  sessions: do AUTOCOMMIT
 
180
#
 
181
SET AUTOCOMMIT = 0;
 
182
use mysqltest1;
 
183
sync_slave_with_master;
 
184
--echo
 
185
--echo -------- switch to slave --------
 
186
connection slave;
 
187
SET AUTOCOMMIT = 1;
 
188
use mysqltest1;
 
189
--echo
 
190
--echo -------- switch to master -------
 
191
connection master;
 
192
 
 
193
 
 
194
# We don't want to abort the whole test if one statement sent
 
195
# to the server gets an error, because the following test
 
196
# sequences are nearly independend of the previous statements. 
 
197
--disable_abort_on_error
 
198
 
 
199
###############################################################
 
200
# Banal case: commands which should never commit
 
201
# Just for checking if the test sequence is usable
 
202
###############################################################
 
203
 
 
204
let $my_stmt= SELECT 1;
 
205
let $my_master_commit= false;
 
206
let $my_slave_commit= false;
 
207
--source include/rpl_stmt_seq.inc
 
208
 
 
209
let $my_stmt= SELECT COUNT(*) FROM t1;
 
210
let $my_master_commit= false;
 
211
let $my_slave_commit= false;
 
212
--source include/rpl_stmt_seq.inc
 
213
 
 
214
###############################################################
 
215
# Banal case: (explicit) COMMIT and ROLLBACK
 
216
# Just for checking if the test sequence is usable
 
217
###############################################################
 
218
 
 
219
let $my_stmt= COMMIT;
 
220
let $my_master_commit= true;
 
221
let $my_slave_commit= true;
 
222
--source include/rpl_stmt_seq.inc
 
223
 
 
224
let $my_stmt= ROLLBACK;
 
225
let $my_master_commit= false;
 
226
let $my_slave_commit= false;
 
227
--source include/rpl_stmt_seq.inc
 
228
 
 
229
###############################################################
 
230
# Cases with commands very similar to COMMIT
 
231
###############################################################
 
232
 
 
233
let $my_stmt= SET AUTOCOMMIT=1;
 
234
let $my_master_commit= true;
 
235
let $my_slave_commit= true;
 
236
--source include/rpl_stmt_seq.inc
 
237
SET AUTOCOMMIT=0;
 
238
 
 
239
let $my_stmt= START TRANSACTION;
 
240
let $my_master_commit= true;
 
241
let $my_slave_commit= true;
 
242
--source include/rpl_stmt_seq.inc
 
243
 
 
244
let $my_stmt= BEGIN;
 
245
let $my_master_commit= true;
 
246
let $my_slave_commit= true;
 
247
--source include/rpl_stmt_seq.inc
 
248
 
 
249
###############################################################
 
250
# Cases with (BASE) TABLES and (UPDATABLE) VIEWs
 
251
###############################################################
 
252
 
 
253
let $my_stmt= DROP TABLE mysqltest1.t2;
 
254
let $my_master_commit= true;
 
255
let $my_slave_commit= true;
 
256
--source include/rpl_stmt_seq.inc
 
257
SHOW TABLES LIKE 't2';
 
258
--echo
 
259
--echo -------- switch to slave --------
 
260
connection slave;
 
261
SHOW TABLES LIKE 't2';
 
262
--echo
 
263
--echo -------- switch to master -------
 
264
connection master;
 
265
 
 
266
let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
 
267
let $my_master_commit= false;
 
268
let $my_slave_commit= false;
 
269
--source include/rpl_stmt_seq.inc
 
270
SHOW TABLES LIKE 't23';
 
271
--echo
 
272
--echo -------- switch to slave --------
 
273
connection slave;
 
274
SHOW TABLES LIKE 't23';
 
275
--echo
 
276
--echo -------- switch to master -------
 
277
connection master;
 
278
 
 
279
let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
 
280
let $my_master_commit= true;
 
281
let $my_slave_commit= true;
 
282
--source include/rpl_stmt_seq.inc
 
283
SHOW TABLES LIKE 't20';
 
284
--echo
 
285
--echo -------- switch to slave --------
 
286
connection slave;
 
287
SHOW TABLES LIKE 't20';
 
288
--echo
 
289
--echo -------- switch to master -------
 
290
connection master;
 
291
 
 
292
let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
 
293
let $my_master_commit= true;
 
294
let $my_slave_commit= true;
 
295
--source include/rpl_stmt_seq.inc
 
296
describe mysqltest1.t4;
 
297
--echo
 
298
--echo -------- switch to slave --------
 
299
connection slave;
 
300
describe mysqltest1.t4;
 
301
--echo
 
302
--echo -------- switch to master -------
 
303
connection master;
 
304
 
 
305
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= $engine_type;
 
306
let $my_master_commit= true;
 
307
let $my_slave_commit= true;
 
308
--source include/rpl_stmt_seq.inc
 
309
 
 
310
let $engine='';
 
311
let $eng_type='';
 
312
 
 
313
let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=$temp_engine_type;
 
314
let $my_master_commit= false;
 
315
let $my_slave_commit= false;
 
316
--source include/rpl_stmt_seq.inc
 
317
 
 
318
let $my_stmt= TRUNCATE TABLE mysqltest1.t7;
 
319
let $my_master_commit= true;
 
320
let $my_slave_commit= true;
 
321
--source include/rpl_stmt_seq.inc
 
322
SELECT * FROM mysqltest1.t7;
 
323
sync_slave_with_master;
 
324
--echo
 
325
--echo -------- switch to slave --------
 
326
connection slave;
 
327
SELECT * FROM mysqltest1.t7;
 
328
--echo
 
329
--echo -------- switch to master -------
 
330
connection master;
 
331
 
 
332
###############################################################
 
333
# Cases with LOCK/UNLOCK
 
334
###############################################################
 
335
 
 
336
# Attention:
 
337
#    We have to LOCK mysqltest1.t1 here, though it violates the testing
 
338
#    philosophy. 
 
339
#    Mysql response in case without previous LOCK TABLES mysqltest1.t1
 
340
#    is:
 
341
#        SELECT MAX(...) FROM mysqltest1.t1 is
 
342
#          ERROR HY000: Table 't1' was not locked with LOCK TABLES
 
343
let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
 
344
let $my_master_commit= true;
 
345
let $my_slave_commit= true;
 
346
--source include/rpl_stmt_seq.inc
 
347
UNLOCK TABLES;
 
348
 
 
349
# No prior locking
 
350
let $my_stmt= UNLOCK TABLES;
 
351
let $my_master_commit= false;
 
352
let $my_slave_commit= false;
 
353
--source include/rpl_stmt_seq.inc
 
354
 
 
355
# With prior read locking
 
356
# Attention:
 
357
#    This subtest generates an error since the rpl_stmt_seq.inc
 
358
#    tries to insert into t1.
 
359
LOCK TABLES mysqltest1.t1 READ;
 
360
let $my_stmt= UNLOCK TABLES;
 
361
let $my_master_commit= false;
 
362
let $my_slave_commit= false;
 
363
--source include/rpl_stmt_seq.inc
 
364
 
 
365
# With prior write locking
 
366
LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ;
 
367
let $my_stmt= UNLOCK TABLES;
 
368
let $my_master_commit= true;
 
369
let $my_slave_commit= true;
 
370
--source include/rpl_stmt_seq.inc
 
371
 
 
372
###############################################################
 
373
# Cases with INDEXES
 
374
###############################################################
 
375
 
 
376
let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6;
 
377
let $my_master_commit= true;
 
378
let $my_slave_commit= true;
 
379
--source include/rpl_stmt_seq.inc
 
380
SHOW INDEX FROM mysqltest1.t6;
 
381
--echo
 
382
--echo -------- switch to slave --------
 
383
connection slave;
 
384
SHOW INDEX FROM mysqltest1.t6;
 
385
--echo
 
386
--echo -------- switch to master -------
 
387
connection master;
 
388
 
 
389
let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
 
390
let $my_master_commit= true;
 
391
let $my_slave_commit= true;
 
392
--source include/rpl_stmt_seq.inc
 
393
SHOW INDEX FROM mysqltest1.t5;
 
394
--echo
 
395
--echo -------- switch to slave --------
 
396
connection slave;
 
397
SHOW INDEX FROM mysqltest1.t5;
 
398
--echo
 
399
--echo -------- switch to master -------
 
400
connection master;
 
401
 
 
402
###############################################################
 
403
# Cases with DATABASE
 
404
###############################################################
 
405
 
 
406
let $my_stmt= DROP DATABASE mysqltest2;
 
407
let $my_master_commit= true;
 
408
let $my_slave_commit= true;
 
409
--source include/rpl_stmt_seq.inc
 
410
SHOW DATABASES LIKE "mysqltest2";
 
411
--echo
 
412
--echo -------- switch to slave --------
 
413
connection slave;
 
414
SHOW DATABASES LIKE "mysqltest2";
 
415
--echo
 
416
--echo -------- switch to master -------
 
417
connection master;
 
418
 
 
419
let $my_stmt= CREATE DATABASE mysqltest3;
 
420
let $my_master_commit= true;
 
421
let $my_slave_commit= true;
 
422
--source include/rpl_stmt_seq.inc
 
423
SHOW DATABASES LIKE "mysqltest3";
 
424
--echo
 
425
--echo -------- switch to slave --------
 
426
connection slave;
 
427
SHOW DATABASES LIKE "mysqltest3";
 
428
--echo
 
429
--echo -------- switch to master -------
 
430
connection master;
 
431
 
 
432
# End of 4.1 tests
 
433
 
 
434
###############################################################
 
435
# Cases with STORED PROCEDUREs
 
436
###############################################################
 
437
let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1";
 
438
let $my_master_commit= true;
 
439
let $my_slave_commit= true;
 
440
--source include/rpl_stmt_seq.inc
 
441
--vertical_results
 
442
--replace_column 5 # 6 #
 
443
SHOW PROCEDURE STATUS LIKE 'p1';
 
444
--echo
 
445
--echo -------- switch to slave --------
 
446
connection slave;
 
447
--replace_column 5 # 6 #
 
448
SHOW PROCEDURE STATUS LIKE 'p1';
 
449
--echo
 
450
--echo -------- switch to master -------
 
451
connection master;
 
452
--horizontal_results
 
453
 
 
454
let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered";
 
455
let $my_master_commit= true;
 
456
let $my_slave_commit= true;
 
457
--source include/rpl_stmt_seq.inc
 
458
--vertical_results
 
459
--replace_column 5 # 6 #
 
460
SHOW PROCEDURE STATUS LIKE 'p1';
 
461
--echo
 
462
--echo -------- switch to slave --------
 
463
connection slave;
 
464
--replace_column 5 # 6 #
 
465
SHOW PROCEDURE STATUS LIKE 'p1';
 
466
--echo
 
467
--echo -------- switch to master -------
 
468
connection master;
 
469
--horizontal_results
 
470
 
 
471
let $my_stmt= DROP PROCEDURE p1;
 
472
let $my_master_commit= true;
 
473
let $my_slave_commit= true;
 
474
--source include/rpl_stmt_seq.inc
 
475
--vertical_results
 
476
SHOW PROCEDURE STATUS LIKE 'p1';
 
477
--echo
 
478
--echo -------- switch to slave --------
 
479
connection slave;
 
480
SHOW PROCEDURE STATUS LIKE 'p1';
 
481
--echo
 
482
--echo -------- switch to master -------
 
483
connection master;
 
484
--horizontal_results
 
485
 
 
486
###############################################################
 
487
# Cases with VIEWs
 
488
###############################################################
 
489
let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
 
490
let $my_master_commit= true;
 
491
let $my_slave_commit= true;
 
492
--source include/rpl_stmt_seq.inc
 
493
SHOW CREATE VIEW v1;
 
494
--echo
 
495
--echo -------- switch to slave --------
 
496
connection slave;
 
497
SHOW CREATE VIEW v1;
 
498
--echo
 
499
--echo -------- switch to master -------
 
500
connection master;
 
501
 
 
502
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
 
503
let $my_master_commit= true;
 
504
let $my_slave_commit= true;
 
505
--source include/rpl_stmt_seq.inc
 
506
SHOW CREATE VIEW v1;
 
507
--echo
 
508
--echo -------- switch to slave --------
 
509
connection slave;
 
510
SHOW CREATE VIEW v1;
 
511
--echo
 
512
--echo -------- switch to master -------
 
513
connection master;
 
514
 
 
515
let $my_stmt= DROP VIEW IF EXISTS v1;
 
516
let $my_master_commit= true;
 
517
let $my_slave_commit= true;
 
518
--source include/rpl_stmt_seq.inc
 
519
--error 1146
 
520
SHOW CREATE VIEW v1;
 
521
--echo
 
522
--echo -------- switch to slave --------
 
523
connection slave;
 
524
--error 1146
 
525
SHOW CREATE VIEW v1;
 
526
--echo
 
527
--echo -------- switch to master -------
 
528
connection master;
 
529
 
 
530
###############################################################
 
531
# Cases with TRIGGERs
 
532
###############################################################
 
533
let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
 
534
let $my_master_commit= true;
 
535
let $my_slave_commit= true;
 
536
--source include/rpl_stmt_seq.inc
 
537
SHOW TRIGGERS;
 
538
--echo
 
539
--echo -------- switch to slave --------
 
540
connection slave;
 
541
SHOW TRIGGERS;
 
542
--echo
 
543
--echo -------- switch to master -------
 
544
connection master;
 
545
 
 
546
let $my_stmt= DROP TRIGGER trg1;
 
547
let $my_master_commit= true;
 
548
let $my_slave_commit= true;
 
549
--source include/rpl_stmt_seq.inc
 
550
SHOW TRIGGERS;
 
551
--echo
 
552
--echo -------- switch to slave --------
 
553
connection slave;
 
554
SHOW TRIGGERS;
 
555
--echo
 
556
--echo -------- switch to master -------
 
557
connection master;
 
558
 
 
559
###############################################################
 
560
# Cases with USERs
 
561
###############################################################
 
562
let $my_stmt= CREATE USER user1@localhost;
 
563
let $my_master_commit= true;
 
564
let $my_slave_commit= true;
 
565
--source include/rpl_stmt_seq.inc
 
566
SELECT user FROM mysql.user WHERE user = 'user1';
 
567
--echo
 
568
--echo -------- switch to slave --------
 
569
connection slave;
 
570
SELECT user FROM mysql.user WHERE user = 'user1';
 
571
--echo
 
572
--echo -------- switch to master -------
 
573
connection master;
 
574
 
 
575
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
 
576
let $my_master_commit= true;
 
577
let $my_slave_commit= true;
 
578
--source include/rpl_stmt_seq.inc
 
579
SELECT user FROM mysql.user WHERE user = 'rename1';
 
580
--echo
 
581
--echo -------- switch to slave --------
 
582
connection slave;
 
583
SELECT user FROM mysql.user WHERE user = 'rename1';
 
584
--echo
 
585
--echo -------- switch to master -------
 
586
connection master;
 
587
 
 
588
let $my_stmt= DROP USER rename1@localhost;
 
589
let $my_master_commit= true;
 
590
let $my_slave_commit= true;
 
591
--source include/rpl_stmt_seq.inc
 
592
SELECT user FROM mysql.user WHERE user = 'rename1';
 
593
--echo
 
594
--echo -------- switch to slave --------
 
595
connection slave;
 
596
SELECT user FROM mysql.user WHERE user = 'rename1';
 
597
 
 
598
###############################################################
 
599
# Cleanup
 
600
###############################################################
 
601
use test;
 
602
--echo
 
603
--echo -------- switch to master -------
 
604
connection master;
 
605
DROP DATABASE mysqltest1;
 
606
# mysqltest2 was alreday DROPPED some tests before.
 
607
DROP DATABASE mysqltest3;
 
608
--enable_warnings
 
609
 
 
610
-- source include/master-slave-end.inc