Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_sp011.test

raw
1 #############################################################################
2 # Original Author: JBM #
3 # Original Date: Aug/18/2005 #
4 # Updated: 08/29/2005 turned on diff and commented out debug SQL statements#
5 # Updated: sep/16/2015 #
6 # This testcase requires minimum stack size of 300KB to run on WIN.#
7 # Modified *-master.opt file to increase the thread_stack to 400KB.#
8 #############################################################################
9 # TEST: SP to test alter table and nested SP calls #
10 #############################################################################
11
12 # clang/UBSAN needs to override the small thread stack in our -master.opt
13 call mtr.add_suppression("option 'thread_stack':");
14
15 # Includes
16 -- source include/have_binlog_format_row.inc
17 -- source include/set_privilege_checks_user_as_system_user.inc
18 -- source include/master-slave.inc
19
20
21 # Begin clean up test section
22 connection master;
23
24 # Begin test section 1
25 CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
26 INSERT INTO test.t1 VALUES (1);
27
28 delimiter |;
29 CREATE PROCEDURE test.p1()
30 BEGIN
31 ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
32 UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
33 CALL test.p2();
34 END|
35 CREATE PROCEDURE test.p2()
36 BEGIN
37 ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
38 UPDATE test.t1 SET f = RAND() WHERE a = 1;
39 CALL test.p3();
40 END|
41 CREATE PROCEDURE test.p3()
42 BEGIN
43 ALTER TABLE test.t1 RENAME test.t2;
44 CALL test.p4();
45 END|
46 CREATE PROCEDURE test.p4()
47 BEGIN
48 ALTER TABLE test.t2 ADD INDEX (f);
49 ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
50 INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
51 CALL test.p5();
52 END|
53 CREATE PROCEDURE test.p5()
54 BEGIN
55 ALTER TABLE test.t2 ORDER BY f;
56 INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
57 CALL test.p6();
58 END|
59 CREATE PROCEDURE test.p6()
60 BEGIN
61 ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
62 ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
63 INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
64 CALL test.p7();
65 END|
66 CREATE PROCEDURE test.p7()
67 BEGIN
68 ALTER TABLE test.t2 DROP COLUMN to_drop;
69 INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
70 END|
71 delimiter ;|
72 CALL test.p1();
73
74 #SELECT * FROM test.t2;
75 --source include/sync_slave_sql_with_master.inc
76 #SELECT * FROM test.t2;
77
78 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql
79 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
80
81 # Cleanup
82 connection master;
83 #show binlog events;
84 DROP PROCEDURE IF EXISTS test.p1;
85 DROP PROCEDURE IF EXISTS test.p2;
86 DROP PROCEDURE IF EXISTS test.p3;
87 DROP PROCEDURE IF EXISTS test.p4;
88 DROP PROCEDURE IF EXISTS test.p5;
89 DROP PROCEDURE IF EXISTS test.p6;
90 DROP PROCEDURE IF EXISTS test.p7;
91 --disable_warnings ER_BAD_TABLE_ERROR
92 DROP TABLE IF EXISTS test.t1;
93 --enable_warnings ER_BAD_TABLE_ERROR
94 DROP TABLE IF EXISTS test.t2;
95 --source include/sync_slave_sql_with_master.inc
96
97 # Lets compare. Note: If they match test will pass, if they do not match
98 # the test will show that the diff statement failed and not reject file
99 # will be created. You will need to go to the mysql-test dir and diff
100 # the files your self to see what is not matching :-) Failed test
101 # Will leave dump files in $MYSQLTEST_VARDIR/tmp
102
103 diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
104
105 # If all is good, when can cleanup our dump files.
106 --remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql
107 --remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
108
109 # End of 5.0 test case
110 --source include/rpl_end.inc