summaryrefslogtreecommitdiff
path: root/storage
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
commit08ee9470a97888380059f8f8b7e6dab1a0eb2da8 (patch)
tree6bbc1f9a1e81646db0f63072646b4b0690cff65d /storage
parent7ae516e1ca56d33581d5531e6bab72136f4b02b8 (diff)
downloadmariadb-git-08ee9470a97888380059f8f8b7e6dab1a0eb2da8.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')
-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);