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