Skip to content

Commit c711abd

Browse files
committed
MDEV-28417 Merge new release of InnoDB 5.7.38 to 10.2
2 parents 3999013 + 44a27a2 commit c711abd

File tree

7 files changed

+105
-34
lines changed

7 files changed

+105
-34
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# MDEV-28416 Incorrect AUTO_INCREMENT may be issued
3+
#
4+
SET @aii=@@auto_increment_increment;
5+
SET auto_increment_increment=300;
6+
CREATE TABLE t1 (a SERIAL) ENGINE=innodb
7+
PARTITION BY RANGE (a) (
8+
PARTITION p0 VALUES LESS THAN (6),
9+
PARTITION p1 VALUES LESS THAN MAXVALUE
10+
);
11+
INSERT INTO t1 VALUES (18446744073709551613);
12+
SHOW CREATE TABLE t1;
13+
Table Create Table
14+
t1 CREATE TABLE `t1` (
15+
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
16+
UNIQUE KEY `a` (`a`)
17+
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
18+
PARTITION BY RANGE (`a`)
19+
(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB,
20+
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
21+
INSERT INTO t1 VALUES (NULL);
22+
ERROR 22003: Out of range value for column 'a' at row 1
23+
SHOW CREATE TABLE t1;
24+
Table Create Table
25+
t1 CREATE TABLE `t1` (
26+
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
27+
UNIQUE KEY `a` (`a`)
28+
) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=latin1
29+
PARTITION BY RANGE (`a`)
30+
(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB,
31+
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
32+
DROP TABLE t1;
33+
SET auto_increment_increment=@aii;
34+
# End of 10.2 tests

mysql-test/suite/innodb/r/innodb-autoinc.result

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
drop table if exists t1;
21
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
32
INSERT INTO t1 VALUES (9223372036854775807, null);
43
INSERT INTO t1 (c2) VALUES ('innodb');
@@ -1619,3 +1618,27 @@ id name
16191618
-1 dog
16201619
2 cat
16211620
DROP PROCEDURE autoinc_mdev15353_one;
1621+
#
1622+
# MDEV-28416 Incorrect AUTO_INCREMENT may be issued
1623+
#
1624+
SET @aii=@@auto_increment_increment;
1625+
SET auto_increment_increment=300;
1626+
CREATE TABLE t1 (a SERIAL) ENGINE=innodb;
1627+
INSERT INTO t1 VALUES (18446744073709551613);
1628+
SHOW CREATE TABLE t1;
1629+
Table Create Table
1630+
t1 CREATE TABLE `t1` (
1631+
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1632+
UNIQUE KEY `a` (`a`)
1633+
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
1634+
INSERT INTO t1 VALUES (NULL);
1635+
ERROR 22003: Out of range value for column 'a' at row 1
1636+
SHOW CREATE TABLE t1;
1637+
Table Create Table
1638+
t1 CREATE TABLE `t1` (
1639+
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1640+
UNIQUE KEY `a` (`a`)
1641+
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
1642+
DROP TABLE t1;
1643+
SET auto_increment_increment=@aii;
1644+
# End of 10.2 tests
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--source include/have_partition.inc
2+
--source include/have_innodb.inc
3+
4+
--echo #
5+
--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued
6+
--echo #
7+
8+
SET @aii=@@auto_increment_increment;
9+
SET auto_increment_increment=300;
10+
11+
CREATE TABLE t1 (a SERIAL) ENGINE=innodb
12+
PARTITION BY RANGE (a) (
13+
PARTITION p0 VALUES LESS THAN (6),
14+
PARTITION p1 VALUES LESS THAN MAXVALUE
15+
);
16+
INSERT INTO t1 VALUES (18446744073709551613);
17+
SHOW CREATE TABLE t1;
18+
--error HA_ERR_AUTOINC_ERANGE
19+
INSERT INTO t1 VALUES (NULL);
20+
SHOW CREATE TABLE t1;
21+
DROP TABLE t1;
22+
SET auto_increment_increment=@aii;
23+
24+
--echo # End of 10.2 tests

mysql-test/suite/innodb/t/innodb-autoinc.test

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
--source include/have_innodb.inc
2-
# embedded server ignores 'delayed', so skip this
3-
-- source include/not_embedded.inc
4-
5-
--disable_warnings
6-
drop table if exists t1;
7-
--enable_warnings
82

93
#
104
# Bug #34335
@@ -770,3 +764,20 @@ DROP TABLE t1;
770764

771765
SET @engine='INNODB';
772766
--source include/autoinc_mdev15353.inc
767+
768+
--echo #
769+
--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued
770+
--echo #
771+
772+
SET @aii=@@auto_increment_increment;
773+
SET auto_increment_increment=300;
774+
CREATE TABLE t1 (a SERIAL) ENGINE=innodb;
775+
INSERT INTO t1 VALUES (18446744073709551613);
776+
SHOW CREATE TABLE t1;
777+
--error HA_ERR_AUTOINC_ERANGE
778+
INSERT INTO t1 VALUES (NULL);
779+
SHOW CREATE TABLE t1;
780+
DROP TABLE t1;
781+
SET auto_increment_increment=@aii;
782+
783+
--echo # End of 10.2 tests

storage/innobase/buf/buf0flu.cc

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2013, 2020, MariaDB Corporation.
4+
Copyright (c) 2013, 2022, MariaDB Corporation.
55
Copyright (c) 2013, 2014, Fusion-io
66
77
This program is free software; you can redistribute it and/or modify it under
@@ -1160,15 +1160,10 @@ buf_flush_page(
11601160
/* For table residing in temporary tablespace sync is done
11611161
using IO_FIX and so before scheduling for flush ensure that
11621162
page is not fixed. */
1163-
flush = FALSE;
1163+
return FALSE;
11641164
} else {
11651165
rw_lock = &reinterpret_cast<buf_block_t*>(bpage)->lock;
1166-
if (flush_type != BUF_FLUSH_LIST) {
1167-
flush = rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE);
1168-
} else {
1169-
/* Will SX lock later */
1170-
flush = TRUE;
1171-
}
1166+
flush = rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE);
11721167
}
11731168

11741169
if (flush) {
@@ -1190,22 +1185,6 @@ buf_flush_page(
11901185

11911186
buf_pool_mutex_exit(buf_pool);
11921187

1193-
if (flush_type == BUF_FLUSH_LIST
1194-
&& is_uncompressed
1195-
&& !rw_lock_sx_lock_nowait(rw_lock, BUF_IO_WRITE)) {
1196-
1197-
if (!fsp_is_system_temporary(bpage->id.space())) {
1198-
/* avoiding deadlock possibility involves
1199-
doublewrite buffer, should flush it, because
1200-
it might hold the another block->lock. */
1201-
buf_dblwr_flush_buffered_writes();
1202-
} else {
1203-
buf_dblwr_sync_datafiles();
1204-
}
1205-
1206-
rw_lock_sx_lock_gen(rw_lock, BUF_IO_WRITE);
1207-
}
1208-
12091188
/* If there is an observer that want to know if the asynchronous
12101189
flushing was sent then notify it.
12111190
Note: we set flush observer to a page with x-latch, so we can

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16970,8 +16970,8 @@ ha_innobase::get_auto_increment(
1697016970

1697116971
(3) It is restricted only for insert operations. */
1697216972

16973-
if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE
16974-
&& autoinc < col_max_value) {
16973+
if (increment > 1 && increment <= ~autoinc && autoinc < col_max_value
16974+
&& thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE) {
1697516975

1697616976
ulonglong prev_auto_inc = autoinc;
1697716977

storage/innobase/include/univ.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri
4141

4242
#define INNODB_VERSION_MAJOR 5
4343
#define INNODB_VERSION_MINOR 7
44-
#define INNODB_VERSION_BUGFIX 37
44+
#define INNODB_VERSION_BUGFIX 38
4545

4646
/* The following is the InnoDB version as shown in
4747
SELECT plugin_version FROM information_schema.plugins;

0 commit comments

Comments
 (0)