1
#############################################################################
2
# This test is being created to test out the non deterministic items with #
3
# row based replication. #
4
# Original Author: JBM #
5
# Original Date: Aug/09/2005 #
7
#############################################################################
8
# Test: Includes two stored procedure tests. First test uses SP to insert #
9
# values from RAND() and NOW() into a table. #
10
# The second test uses SP with CASE structure to decide what to text #
11
# to update a given table with. #
12
############################################################################
15
-- source include/have_binlog_format_row.inc
16
-- source include/master-slave.inc
21
# Begin clean up test section
24
DROP PROCEDURE IF EXISTS test.p1;
25
DROP PROCEDURE IF EXISTS test.p2;
26
DROP TABLE IF EXISTS test.t1;
27
DROP TABLE IF EXISTS test.t2;
32
# Begin test section 1 for non deterministic SP
33
let $message=<Begin test section 1 (non deterministic SP)>;
34
--source include/show_msg.inc
36
create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
39
create procedure test.p1()
41
INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
61
#select * from test.t1;
62
#sync_slave_with_master;
63
#select * from test.t1;
66
let $message=<End test section 1 (non deterministic SP)>;
67
--source include/show_msg.inc
70
CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
73
CREATE PROCEDURE test.p2(n int)
77
UPDATE test.t2 set t ='Tex';
79
UPDATE test.t2 set t ='SQL';
81
UPDATE test.t2 set t ='NONE';
86
INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
88
SELECT * FROM t2 ORDER BY a;
92
SELECT * FROM t2 ORDER BY a;
96
SELECT * FROM t2 ORDER BY a;
97
sync_slave_with_master;
98
SELECT * FROM t2 ORDER BY a;
103
SELECT * FROM t2 ORDER BY a;
107
SELECT * FROM t2 ORDER BY a;
111
SELECT * FROM t2 ORDER BY a;
115
SELECT * FROM t2 ORDER BY a;
120
# time to dump the databases and so we can see if they match
122
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql
123
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
128
DROP PROCEDURE test.p1;
129
DROP PROCEDURE test.p2;
132
sync_slave_with_master;
134
# Lets compare. Note: If they match test will pass, if they do not match
135
# the test will show that the diff statement failed and not reject file
136
# will be created. You will need to go to the mysql-test dir and diff
137
# the files your self to see what is not matching :-) Failed dump files
138
# will be located in $MYSQLTEST_VARDIR/tmp
140
diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
142
# If all is good, when can cleanup our dump files.
143
remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql;
144
remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
146
# End of 5.0 test case