summaryrefslogtreecommitdiff
path: root/storage/innobase/handler/ha_innodb.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-11-02 18:43:20 +0400
committerSergey Vojtovich <svoj@sun.com>2009-11-02 18:43:20 +0400
commitc8d97af6b06b8c235d411c736b5360a2c35d8640 (patch)
treebc5a667f80e1c6d49368975029e73a4f23b1dafc /storage/innobase/handler/ha_innodb.cc
parent71d24a23719ebe1f3be3f166ef11acf3c531196a (diff)
downloadmariadb-git-c8d97af6b06b8c235d411c736b5360a2c35d8640.tar.gz
Applying InnoDB snashot 5.1-ss6129
Detailed revision comments: r6051 | sunny | 2009-10-12 07:05:00 +0300 (Mon, 12 Oct 2009) | 6 lines branches/5.1: Ignore negative values supplied by the user when calculating the next value to store in dict_table_t. Setting autoincrement columns top negative values is undefined behavior and this change should bring the behavior of InnoDB closer to what users expect. Added several tests to check. rb://162
Diffstat (limited to 'storage/innobase/handler/ha_innodb.cc')
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 0e951d00f59..3b096d9bab3 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7880,6 +7880,7 @@ ha_innobase::get_auto_increment(
AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
ulonglong need;
+ ulonglong current;
ulonglong next_value;
ulonglong col_max_value;
@@ -7888,11 +7889,12 @@ ha_innobase::get_auto_increment(
col_max_value = innobase_get_int_col_max_value(
table->next_number_field);
+ current = *first_value > col_max_value ? autoinc : *first_value;
need = *nb_reserved_values * increment;
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
- *first_value, need, offset, col_max_value);
+ current, need, offset, col_max_value);
prebuilt->autoinc_last_value = next_value;