mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
Revert "MDEV-8827 Duplicate key with auto increment"
This reverts commitef47b62551
. The parent commit07ba5560da
which is a backport of mysql/mysql-server@1198267c33 fixes the issue differently.
This commit is contained in:
@@ -567,7 +567,7 @@ Variable_name Value
|
|||||||
auto_increment_increment 65535
|
auto_increment_increment 65535
|
||||||
auto_increment_offset 65535
|
auto_increment_offset 65535
|
||||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
c1
|
c1
|
||||||
1
|
1
|
||||||
@@ -660,7 +660,7 @@ t2 CREATE TABLE `t2` (
|
|||||||
`n` int(10) unsigned NOT NULL,
|
`n` int(10) unsigned NOT NULL,
|
||||||
`o` enum('FALSE','TRUE') DEFAULT NULL,
|
`o` enum('FALSE','TRUE') DEFAULT NULL,
|
||||||
PRIMARY KEY (`m`)
|
PRIMARY KEY (`m`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
|
||||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
|
@@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
|
|||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
|
||||||
SHOW VARIABLES LIKE "%auto_inc%";
|
SHOW VARIABLES LIKE "%auto_inc%";
|
||||||
--error 1467
|
--error 167
|
||||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@@ -1504,11 +1504,10 @@ innobase_next_autoinc(
|
|||||||
if (next_value == 0) {
|
if (next_value == 0) {
|
||||||
ulonglong next;
|
ulonglong next;
|
||||||
|
|
||||||
if (current >= offset) {
|
if (current > offset) {
|
||||||
next = (current - offset) / step;
|
next = (current - offset) / step;
|
||||||
} else {
|
} else {
|
||||||
next = 0;
|
next = (offset - current) / step;
|
||||||
block -= step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(max_value > next);
|
ut_a(max_value > next);
|
||||||
@@ -10530,12 +10529,15 @@ ha_innobase::get_auto_increment(
|
|||||||
|
|
||||||
current = *first_value;
|
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 = autoinc - prebuilt->autoinc_increment;
|
||||||
|
|
||||||
current = innobase_next_autoinc(
|
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);
|
dict_table_autoinc_initialize(prebuilt->table, current);
|
||||||
|
|
||||||
|
@@ -1774,11 +1774,10 @@ innobase_next_autoinc(
|
|||||||
if (next_value == 0) {
|
if (next_value == 0) {
|
||||||
ulonglong next;
|
ulonglong next;
|
||||||
|
|
||||||
if (current >= offset) {
|
if (current > offset) {
|
||||||
next = (current - offset) / step;
|
next = (current - offset) / step;
|
||||||
} else {
|
} else {
|
||||||
next = 0;
|
next = (offset - current) / step;
|
||||||
block -= step;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(max_value > next);
|
ut_a(max_value > next);
|
||||||
@@ -11799,12 +11798,15 @@ ha_innobase::get_auto_increment(
|
|||||||
|
|
||||||
current = *first_value;
|
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 = autoinc - prebuilt->autoinc_increment;
|
||||||
|
|
||||||
current = innobase_next_autoinc(
|
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);
|
dict_table_autoinc_initialize(prebuilt->table, current);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user