--source include/master-slave.inc --source include/have_innodb.inc let $attempts = 300; connection master; --disable_warnings DROP DATABASE IF EXISTS systest1; DROP DATABASE IF EXISTS table_logs; --enable_warnings CREATE DATABASE systest1; CREATE DATABASE table_logs; USE systest1; CREATE TABLE systest1.tb1_master (f1 int, f2 char (15), f3 decimal (5,3), f4 datetime) ENGINE = MyISAM; LOAD DATA LOCAL INFILE 'tb1.txt' INTO TABLE systest1.tb1_master; CREATE TABLE systest1.tb7_eng1 (f1 int, f2 char (15), f3 decimal (5,3), f4 datetime, index (f1)) ENGINE = InnoDB; LOAD DATA LOCAL INFILE 'tb1.txt' INTO TABLE systest1.tb7_eng1 (f1,f2,f3,f4); CREATE TABLE table_logs.tb1_logs (i1 int NOT NULL auto_increment, primary key (i1), dt1 datetime NOT NULL, entry_dsc char(100), f4 int) ENGINE = myisam; delimiter //; create function int_rand(num bigint) returns bigint BEGIN return round(num*rand()+0.5); END// CREATE TRIGGER systest1.tb7_eng1_ins AFTER INSERT ON tb7_eng1 FOR EACH ROW BEGIN insert into table_logs.tb1_logs (dt1, entry_dsc, f4) values (now(), concat('Insert row ', new.f1,' ', new.f2, ' ', new.f3, ' (tb7_eng1)'), new.f1); END // create procedure ins_tb7_eng1 (num_pr int, str_pr char(15)) BEGIN declare done int default 0; declare v3 decimal(5,3); declare cur1 cursor for select f3 from tb1_master where f1=num_pr; declare continue handler for sqlstate '01000' set done = 1; declare continue handler for sqlstate '02000' set done = 1; open cur1; fetch cur1 into v3; wl_loop: WHILE NOT done DO insert into tb7_eng1 (f1,f2,f3,f4) values (int_rand(15), concat('I:',str_pr,'-',num_pr), v3, now()); fetch cur1 into v3; END WHILE wl_loop; close cur1; END// delimiter ;// FLUSH LOGS; while ($attempts) { send CALL ins_tb7_eng1(8,'yVuZ'); connection master1; flush logs; connection master; reap; SHOW MASTER STATUS; dec $attempts; }