mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
211f9eea60
The problem was that the code in replication didn't distinguish between a setval() failing because the stored sequence number was bigger than the current (should have been ignored) and a failure from the storage engine.
108 lines
2.3 KiB
Text
108 lines
2.3 KiB
Text
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
|