summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-23 11:01:44 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-23 11:01:44 +0300
commit7153e155424de4b42bc0f96ceb6433e4ed1f827a (patch)
treecb77379346a10b5730deb6b0bfc27a9d327c5fd4 /storage/innobase
parent07ba5560da805c766da68811692272dd9eebdaf7 (diff)
downloadmariadb-git-7153e155424de4b42bc0f96ceb6433e4ed1f827a.tar.gz
Revert "MDEV-8827 Duplicate key with auto increment"
This reverts commit ef47b62551b0f37770e5d174ea028150c5b71fd8. The parent commit 07ba5560da805c766da68811692272dd9eebdaf7 which is a backport of mysql/mysql-server@1198267c331b045b9cad26be72b1a5b4f8930a79 fixes the issue differently.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/ha_innodb.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 8b48552eed4..dab43efbf94 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1504,11 +1504,10 @@ innobase_next_autoinc(
if (next_value == 0) {
ulonglong next;
- if (current >= offset) {
+ if (current > offset) {
next = (current - offset) / step;
} else {
- next = 0;
- block -= step;
+ next = (offset - current) / step;
}
ut_a(max_value > next);
@@ -10530,12 +10529,15 @@ ha_innobase::get_auto_increment(
current = *first_value;
- if (prebuilt->autoinc_increment != increment) {
+ /* If the increment step of the auto increment column
+ decreases then it is not affecting the immediate
+ next value in the series. */
+ if (prebuilt->autoinc_increment > increment) {
current = autoinc - prebuilt->autoinc_increment;
current = innobase_next_autoinc(
- current, 1, increment, offset, col_max_value);
+ current, 1, increment, 1, col_max_value);
dict_table_autoinc_initialize(prebuilt->table, current);