MDEV-15732: Assertion `next_free_value % real_increment == offset && next_free_value >= reserved_until' failed in sequence_definition::adjust_values upon SETVAL for sequence with INCREMENT 0

there was a problem with "next_free_value >= reserved_until" condition:
SEQUENCE::set_value handle next_free_value & reserved_until after adjust_values() call, so it is incorect to put assert on it in adjust_values()
This commit is contained in:
Oleksandr Byelkin 2018-04-25 21:32:47 +02:00
parent 7f89d9c9e3
commit 0bdc15d86e
3 changed files with 33 additions and 2 deletions

View File

@ -254,3 +254,18 @@ def SETVAL(s1,10) 8 20 2 Y 32896 0 63
SETVAL(s1,10)
10
DROP SEQUENCE s1;
#
# MDEV-15732: Assertion `next_free_value % real_increment == offset &&
# next_free_value >= reserved_until' failed in
# sequence_definition::adjust_values upon SETVAL for sequence with
# INCREMENT 0
#
CREATE SEQUENCE s INCREMENT 0;
SELECT NEXTVAL(s);
NEXTVAL(s)
1
SELECT SETVAL(s, 10);
SETVAL(s, 10)
10
DROP SEQUENCE s;
# End of 10.3 tests

View File

@ -137,3 +137,20 @@ SELECT SETVAL(s1,10);
DROP SEQUENCE s1;
--enable_ps_protocol
--disable_metadata
--echo #
--echo # MDEV-15732: Assertion `next_free_value % real_increment == offset &&
--echo # next_free_value >= reserved_until' failed in
--echo # sequence_definition::adjust_values upon SETVAL for sequence with
--echo # INCREMENT 0
--echo #
CREATE SEQUENCE s INCREMENT 0;
SELECT NEXTVAL(s);
SELECT SETVAL(s, 10);
# Cleanup
DROP SEQUENCE s;
--echo # End of 10.3 tests

View File

@ -560,8 +560,7 @@ void sequence_definition::adjust_values(longlong next_value)
else
{
next_free_value+= to_add;
DBUG_ASSERT(next_free_value % real_increment == offset &&
next_free_value >= reserved_until);
DBUG_ASSERT(next_free_value % real_increment == offset);
}
}
}