diff options
author | Monty <monty@mariadb.org> | 2018-08-30 17:32:26 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-08-30 17:38:01 +0300 |
commit | 7aa80ba66b042bbcd6f2576522bb87a1fc83a281 (patch) | |
tree | 05c032b065b332d410e96f18788f2f9677efc07e /sql/sql_sequence.cc | |
parent | ceb559718438c1aef112c0de66e7b5368d2f5c25 (diff) | |
download | mariadb-git-7aa80ba66b042bbcd6f2576522bb87a1fc83a281.tar.gz |
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.
Diffstat (limited to 'sql/sql_sequence.cc')
-rw-r--r-- | sql/sql_sequence.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 21a8781087f..1fb2e5e7714 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -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); } } } |