summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorRahul Malik <rahul.m.malik@oracle.com>2019-05-02 10:43:17 +0530
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-23 11:26:11 +0300
commit739f5239f12904247d2a61f9880ea1fafbedc332 (patch)
treee9596e5132fcbf02b70aca779e63a4f02deb767c /storage/innobase
parent7153e155424de4b42bc0f96ceb6433e4ed1f827a (diff)
downloadmariadb-git-739f5239f12904247d2a61f9880ea1fafbedc332.tar.gz
Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS
Problem: Clients running different values for auto_increment_increment and doing concurrent inserts leads to "Duplicate key error" in one of them. Analysis: When auto_increment_increment value is reduced in a session, InnoDB uses last auto_increment_increment value to recalculate the autoinc value. In case, some other session has inserted a value with different auto_increment_increment, InnoDB recalculate autoinc values based on current session previous auto_increment_increment instead of considering the auto_increment_increment used for last insert across all session Fix: revert 7acdf29cb4f90498af143430e3bf0e9fd3bd39f5 a.k.a. 7c12a9e5c3200688612d59160e8f45b1c8451635 as it causing the bug. Reviewed By: Bin <bin.x.su@oracle.com> Kevin <kevin.lewis@oracle.com> RB#21777 Note: In MariaDB Server, earlier changes in ae5bc059880c395ccf2cc51d5db1895dffc4f5f0 for MDEV-533 require that the original test in mysql/mysql-server@1ccd472d63a042d3237a55f5827239164219ef7e be adjusted for MariaDB. Also, ef47b62551b0f37770e5d174ea028150c5b71fd8 (MDEV-8827) had to be reverted after the upstream fix had been backported.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/ha_innodb.cc18
1 files changed, 2 insertions, 16 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index dab43efbf94..5b9c9dc9123 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1,8 +1,9 @@
/*****************************************************************************
-Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
+Copyright (c) 2010, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -10529,21 +10530,6 @@ ha_innobase::get_auto_increment(
current = *first_value;
- /* 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, 1, col_max_value);
-
- dict_table_autoinc_initialize(prebuilt->table, current);
-
- *first_value = current;
- }
-
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
current, *nb_reserved_values, increment, offset,