# 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.
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t TIMESTAMP, t2 TIMESTAMP, PRIMARY KEY(a));
delimiter //;
create function test.f1() RETURNS TIMESTAMP
BEGIN
UPDATE test.t1 SET t = CURRENT_TIMESTAMP;
RETURN CURRENT_TIMESTAMP;
END//
delimiter ;//
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
#select * from test.t1;
#save_master_pos;
#sync_slave_with_master;
#connection slave;
#select * from test.t1;
#connection master;
SET TIMESTAMP=2;
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
#select * from test.t1;
#save_master_pos;
#sync_slave_with_master;
#connection slave;
#select * from test.t1;
#connection master;
#sleep 3;
SET TIMESTAMP=1;
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
#select * from test.t1;
#save_master_pos;
#sync_slave_with_master;
#connection slave;
#select * from test.t1;
#connection master;
SET TIMESTAMP=333300000;
INSERT INTO test.t2 VALUES (null,f1(),CURRENT_TIMESTAMP);
# We need a sync to ensure that the slave has caught up before
# dumping the database.
sync_slave_with_master;
connection master;
#Used for debugging
#show binlog events;
# time to dump the databases and so we can see if they match