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/10/2005 #
6
# Update: 08/29/2005 Turn on diff #
7
#############################################################################
8
# Note: Many lines are commented out in this test case. These were used for #
9
# creating the test case and debugging and are being left for #
10
# debugging, but they can not be used for the regular testing as the #
11
# Time changes and is not deteministic, so instead we dump both the #
12
# master and slave and diff the dumps. If the dumps differ then the #
13
# test case will fail. To run during diff failuers, comment out the #
15
#############################################################################
18
-- source include/have_binlog_format_row.inc
19
-- source include/master-slave.inc
22
# Begin clean up test section
26
DROP FUNCTION test.f1;
27
DROP TABLE IF EXISTS test.t1;
28
DROP TABLE IF EXISTS test.t2;
32
# Section 1 test from Peter G. This test changes uses a stored function to update rows and return the timestamp. We change the value of the time stamp on the master to see what is replicated.
34
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
35
CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
38
create function test.f1() RETURNS TIMESTAMP
40
UPDATE test.t1 SET t = CURRENT_TIMESTAMP;
41
RETURN CURRENT_TIMESTAMP;
45
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
46
#select * from test.t1;
48
#sync_slave_with_master;
50
#select * from test.t1;
55
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
56
#select * from test.t1;
58
#sync_slave_with_master;
60
#select * from test.t1;
65
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
66
#select * from test.t1;
68
#sync_slave_with_master;
70
#select * from test.t1;
74
SET TIMESTAMP=333300000;
75
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
77
# We need a sync to ensure that the slave has caught up before
78
# dumping the database.
79
sync_slave_with_master;
85
# time to dump the databases and so we can see if they match
87
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_master.sql
88
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func002_slave.sql
91
DROP FUNCTION test.f1;
94
sync_slave_with_master;
96
# the test will show that the diff statement failed and no reject file
97
# will be created. You will need to go to the mysql-test dir and diff
98
# the files your self to see what is not matching :-). The files are located
99
# in mysql-test/var/tmp
101
diff_files $MYSQLTEST_VARDIR/tmp/func002_master.sql $MYSQLTEST_VARDIR/tmp/func002_slave.sql;
103
# End of 5.0 test case