include/master-slave.inc [connection master] CREATE SEQUENCE s; INSERT INTO s VALUES (1,1,4,1,1,1,0,0); show create sequence s; Table Create Table s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 4 increment by 1 cache 1 nocycle ENGINE=MyISAM SELECT NEXTVAL(s); NEXTVAL(s) 1 connection slave; SELECT NEXTVAL(s); NEXTVAL(s) 2 SELECT NEXTVAL(s); NEXTVAL(s) 3 connection master; SELECT NEXTVAL(s); NEXTVAL(s) 2 SELECT NEXTVAL(s); NEXTVAL(s) 3 SELECT NEXTVAL(s); NEXTVAL(s) 4 select * from s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 5 1 4 1 1 1 0 0 connection slave; select * from s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 5 1 4 1 1 1 0 0 connection master; DROP SEQUENCE s; CREATE SEQUENCE s; INSERT INTO s VALUES (1,1,3,1,1,1,1,0); show create sequence s; Table Create Table s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 3 increment by 1 cache 1 cycle ENGINE=MyISAM SELECT NEXTVAL(s); NEXTVAL(s) 1 connection slave; SELECT NEXTVAL(s); NEXTVAL(s) 2 SELECT NEXTVAL(s); NEXTVAL(s) 3 connection master; SELECT NEXTVAL(s); NEXTVAL(s) 2 SELECT NEXTVAL(s); NEXTVAL(s) 3 SELECT NEXTVAL(s); NEXTVAL(s) 1 select * from s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 2 1 3 1 1 1 1 1 connection slave; select * from s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 2 1 3 1 1 1 1 1 connection master; DROP SEQUENCE s; CREATE SEQUENCE s; INSERT INTO s VALUES (1,1,3,1,1,1,1,0); SELECT NEXTVAL(s); NEXTVAL(s) 1 CREATE PROCEDURE pr(n INT) BEGIN DECLARE i INT DEFAULT 0; WHILE i < n DO SELECT NEXTVAL(s); SELECT NEXTVAL(s); SELECT NEXTVAL(s); SET i= i+1; END WHILE; END $ connect con1,localhost,root,,; CALL pr(100); connect con2,localhost,root,,; CALL pr(100); connect con3,localhost,root,,; CALL pr(100); connect con4,localhost,root,,; CALL pr(100); connect con5,localhost,root,,; CALL pr(100); connect con6,localhost,root,,; CALL pr(100); connect con7,localhost,root,,; CALL pr(100); connect con8,localhost,root,,; CALL pr(100); connection master; connection slave; connection master; DROP SEQUENCE s; DROP PROCEDURE pr; include/rpl_end.inc