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());
54
let $wait_condition= SELECT COUNT(*) = @wait_count FROM test.t1;
55
-- source include/wait_condition.inc
57
SET @wait_count = @wait_count + 1;
65
#select * from test.t1;
66
#sync_slave_with_master;
67
#select * from test.t1;
70
let $message=<End test section 1 (non deterministic SP)>;
71
--source include/show_msg.inc
74
CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
77
CREATE PROCEDURE test.p2(n int)
81
UPDATE test.t2 set t ='Tex';
83
UPDATE test.t2 set t ='SQL';
85
UPDATE test.t2 set t ='NONE';
90
INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
92
SELECT * FROM t2 ORDER BY a;
96
SELECT * FROM t2 ORDER BY a;
100
SELECT * FROM t2 ORDER BY a;
101
sync_slave_with_master;
102
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;
119
SELECT * FROM t2 ORDER BY a;
124
# time to dump the databases and so we can see if they match
126
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql
127
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
132
DROP PROCEDURE test.p1;
133
DROP PROCEDURE test.p2;
136
sync_slave_with_master;
138
# Lets compare. Note: If they match test will pass, if they do not match
139
# the test will show that the diff statement failed and not reject file
140
# will be created. You will need to go to the mysql-test dir and diff
141
# the files your self to see what is not matching :-) Failed dump files
142
# will be located in $MYSQLTEST_VARDIR/tmp
144
diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
146
# If all is good, when can cleanup our dump files.
147
--remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql
148
--remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
150
# End of 5.0 test case