summaryrefslogtreecommitdiff
path: root/storage/innobase/handler
diff options
context:
space:
mode:
authorTimothy Smith <timothy.smith@sun.com>2009-03-11 18:17:53 -0600
committerTimothy Smith <timothy.smith@sun.com>2009-03-11 18:17:53 -0600
commit071cd489676069726cef7ae3227da65ac5c9bd55 (patch)
tree6bbc1f9a1e81646db0f63072646b4b0690cff65d /storage/innobase/handler
parent4e42869a0a1639bcc1d55fb5b4d9e0adb64645de (diff)
downloadmariadb-git-071cd489676069726cef7ae3227da65ac5c9bd55.tar.gz
Applying InnoDB snashot 5.1-ss4350, part 4. Fixes
Bug #42714 AUTO_INCREMENT errors in 5.1.31 Detailed revision comments: r4287 | sunny | 2009-02-25 05:32:01 +0200 (Wed, 25 Feb 2009) | 10 lines branches/5.1: Fix Bug#42714 AUTO_INCREMENT errors in 5.1.31. There are two changes to the autoinc handling. 1. To fix the immediate problem from the bug report, we must ensure that the value written to the table is always less than the max value stored in dict_table_t. 2. The second related change is that according to MySQL documentation when the offset is greater than the increment, we should ignore the offset.
Diffstat (limited to 'storage/innobase/handler')
-rw-r--r--storage/innobase/handler/ha_innodb.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 5c4e111b67d..b125c731228 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -953,6 +953,12 @@ innobase_next_autoinc(
/* Should never be 0. */
ut_a(increment > 0);
+ /* According to MySQL documentation, if the offset is greater than
+ the increment then the offset is ignored. */
+ if (offset > increment) {
+ offset = 0;
+ }
+
if (max_value <= current) {
next_value = max_value;
} else if (offset <= 1) {
@@ -3780,7 +3786,7 @@ no_commit:
will be 0 if get_auto_increment() was not called.*/
if (auto_inc <= col_max_value
- && auto_inc > prebuilt->autoinc_last_value) {
+ && auto_inc >= prebuilt->autoinc_last_value) {
set_max_autoinc:
ut_a(prebuilt->autoinc_increment > 0);