mirror of
https://github.com/MariaDB/server.git
synced 2025-07-07 06:01:31 +03:00
Sequences with negative numbers and auto_increment_increment crashes
This also fixes MDEV-16313 Assertion `next_free_value % real_increment == offset' fails upon CREATE SEQUENCE in galera cluster Fixed by adding llabs() to assert. Also adjusted auto_increment_offset to mod auto_increment_increment.
This commit is contained in:
@ -542,7 +542,8 @@ void sequence_definition::adjust_values(longlong next_value)
|
||||
|
||||
if ((real_increment= global_system_variables.auto_increment_increment)
|
||||
!= 1)
|
||||
offset= global_system_variables.auto_increment_offset;
|
||||
offset= (global_system_variables.auto_increment_offset %
|
||||
global_system_variables.auto_increment_increment);
|
||||
|
||||
/*
|
||||
Ensure that next_free_value has the right offset, so that we
|
||||
@ -564,7 +565,7 @@ void sequence_definition::adjust_values(longlong next_value)
|
||||
else
|
||||
{
|
||||
next_free_value+= to_add;
|
||||
DBUG_ASSERT(next_free_value % real_increment == offset);
|
||||
DBUG_ASSERT(llabs(next_free_value % real_increment) == offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user