mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
134 lines
4.4 KiB
Text
134 lines
4.4 KiB
Text
|
set global event_scheduler=1;
|
||
|
stop slave;
|
||
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||
|
reset master;
|
||
|
reset slave;
|
||
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||
|
start slave;
|
||
|
set binlog_format=row;
|
||
|
DROP EVENT IF EXISTS justonce;
|
||
|
drop table if exists t1,t2;
|
||
|
CREATE TABLE `t1` (
|
||
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`c` VARCHAR(50) NOT NULL,
|
||
|
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
|
||
|
CURRENT_TIMESTAMP,
|
||
|
PRIMARY KEY (`id`)
|
||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||
|
INSERT INTO t1 (c) VALUES ('manually');
|
||
|
CREATE EVENT justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTo t1
|
||
|
(c) VALUES ('from justonce');
|
||
|
"in the master"
|
||
|
SELECT * FROM t1;
|
||
|
id c ts
|
||
|
1 manually TIMESTAMP
|
||
|
2 from justonce TIMESTAMP
|
||
|
affected rows: 2
|
||
|
"in the slave"
|
||
|
SELECT * FROM t1;
|
||
|
id c ts
|
||
|
1 manually TIMESTAMP
|
||
|
2 from justonce TIMESTAMP
|
||
|
affected rows: 2
|
||
|
DROP EVENT IF EXISTS test.slave_once;
|
||
|
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
|
||
|
INSERT INTO t1(c) VALUES ('from slave_once');
|
||
|
SELECT db, name, status, originator FROM mysql.event;
|
||
|
db name status originator
|
||
|
test justonce SLAVESIDE_DISABLED 1
|
||
|
test slave_once ENABLED 2
|
||
|
DROP EVENT IF EXISTS test.slave_once;
|
||
|
DROP EVENT IF EXISTS test.justonce;
|
||
|
Warnings:
|
||
|
Note 1305 Event justonce does not exist
|
||
|
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
|
||
|
INSERT INTO t1(c) VALUES ('from er');
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er ENABLED 1
|
||
|
"in the slave"
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er SLAVESIDE_DISABLED 1
|
||
|
"in the master"
|
||
|
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er ENABLED 1
|
||
|
"in the slave"
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er SLAVESIDE_DISABLED 1
|
||
|
"in the master"
|
||
|
DROP EVENT test.er;
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
"in the slave"
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
"in the master"
|
||
|
DROP TABLE t1;
|
||
|
set binlog_format=statement;
|
||
|
DROP EVENT IF EXISTS justonce;
|
||
|
drop table if exists t1,t2;
|
||
|
CREATE TABLE `t1` (
|
||
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||
|
`c` VARCHAR(50) NOT NULL,
|
||
|
`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
|
||
|
CURRENT_TIMESTAMP,
|
||
|
PRIMARY KEY (`id`)
|
||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||
|
INSERT INTO t1 (c) VALUES ('manually');
|
||
|
CREATE EVENT justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTo t1
|
||
|
(c) VALUES ('from justonce');
|
||
|
"in the master"
|
||
|
SELECT * FROM t1;
|
||
|
id c ts
|
||
|
1 manually TIMESTAMP
|
||
|
2 from justonce TIMESTAMP
|
||
|
affected rows: 2
|
||
|
"in the slave"
|
||
|
SELECT * FROM t1;
|
||
|
id c ts
|
||
|
1 manually TIMESTAMP
|
||
|
2 from justonce TIMESTAMP
|
||
|
affected rows: 2
|
||
|
DROP EVENT IF EXISTS test.slave_once;
|
||
|
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
|
||
|
INSERT INTO t1(c) VALUES ('from slave_once');
|
||
|
SELECT db, name, status, originator FROM mysql.event;
|
||
|
db name status originator
|
||
|
test justonce SLAVESIDE_DISABLED 1
|
||
|
test slave_once ENABLED 2
|
||
|
DROP EVENT IF EXISTS test.slave_once;
|
||
|
DROP EVENT IF EXISTS test.justonce;
|
||
|
Warnings:
|
||
|
Note 1305 Event justonce does not exist
|
||
|
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
|
||
|
INSERT INTO t1(c) VALUES ('from er');
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er ENABLED 1
|
||
|
"in the slave"
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er SLAVESIDE_DISABLED 1
|
||
|
"in the master"
|
||
|
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er');
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er ENABLED 1
|
||
|
"in the slave"
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
test er SLAVESIDE_DISABLED 1
|
||
|
"in the master"
|
||
|
DROP EVENT test.er;
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
"in the slave"
|
||
|
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'er';
|
||
|
db name status originator
|
||
|
"in the master"
|
||
|
DROP TABLE t1;
|