Commit 0bdc15d8 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-15732: Assertion `next_free_value % real_increment == offset &&...

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()
parent 7f89d9c9
......@@ -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
......@@ -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
......@@ -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);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment