Debian Codegraph @

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

raw
1 #############################################################################
2 # Original Author: JBM #
3 # Original Date: Aug/18/2005 #
4 # Updated 08/30/2005 Added dumps and diff #
5 #############################################################################
6 #TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12480 #
7 #############################################################################
8
9 # Includes
10 -- source include/have_binlog_format_row.inc
11 -- source include/master-slave.inc
12
13
14 # Begin clean up test section
15 connection master;
16 --disable_warnings
17 create database if not exists mysqltest1;
18 DROP TABLE IF EXISTS mysqltest1.t1;
19 --enable_warnings
20
21
22 # Begin test section 1
23 CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
24 a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
25 b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
26 PRIMARY KEY(n));
27 delimiter |;
28 CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
29 BEGIN
30 DECLARE v1 INT DEFAULT 300;
31 WHILE v1 > 0 DO
32 SET v1 = v1 - 1;
33 END WHILE;
34 RETURN NOW();
35 END|
36 delimiter ;|
37
38 INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
39
40 delimiter |;
41 CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
42 FOR EACH ROW BEGIN
43 SET new.b = mysqltest1.f1();
44 END|
45 delimiter ;|
46
47 INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
48
49 sync_slave_with_master;
50
51 connection master;
52
53 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql
54 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
55
56 # lets cleanup
57 DROP TABLE IF EXISTS mysqltest1.t1;
58 DROP FUNCTION mysqltest1.f1;
59 DROP DATABASE mysqltest1;
60
61 # Lets compare. Note: If they match test will pass, if they do not match
62 # the test will show that the diff statement failed and not reject file
63 # will be created. You will need to go to the mysql-test dir and diff
64 # the files your self to see what is not matching :-) The failed dump
65 # files will be located in $MYSQLTEST_VARDIR/tmp
66
67 diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
68
69 # If all is good, when can cleanup our dump files.
70 --remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql
71 --remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
72
73 sync_slave_with_master;
74 # End of 5.1 test case
75 --source include/rpl_end.inc