Skip to content

Commit b7a75fb

Browse files
MDEV-34169 Don't allow innodb_open_files to be lesser than
number of non-user tablespace. - InnoDB only closes the user tablespace when the number of open files exceeds innodb_open_files limit. In that case, InnoDB should make sure that innodb_open_files value should be greater than number of undo tablespace, system and temporary tablespace files.
1 parent 238798d commit b7a75fb

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
call mtr.add_suppression("\\[Warning\\] InnoDB: innodb_open_files=.* is not greater than the number of system tablespace files, temporary tablespace files, innodb_undo_tablespaces=.*");
2+
FOUND 1 /\[Warning\] InnoDB: innodb_open_files=.* is not greater than the number of system tablespace files, temporary tablespace files, innodb_undo_tablespaces=.*/ in mysqld.1.err
3+
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
4+
DROP TABLE t1;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--innodb_undo_tablespaces=8
2+
--innodb_open_files=10
3+
--innodb_temp_data_file_path=ibtmp1:32M;ibtmp2:32M:autoextend
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--source include/have_innodb.inc
2+
--source include/not_embedded.inc
3+
call mtr.add_suppression("\\[Warning\\] InnoDB: innodb_open_files=.* is not greater than the number of system tablespace files, temporary tablespace files, innodb_undo_tablespaces=.*");
4+
let SEARCH_PATTERN= \[Warning\] InnoDB: innodb_open_files=.* is not greater than the number of system tablespace files, temporary tablespace files, innodb_undo_tablespaces=.*;
5+
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
6+
--source include/search_pattern_in_file.inc
7+
8+
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
9+
DROP TABLE t1;

storage/innobase/handler/ha_innodb.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,6 +3860,21 @@ static int innodb_init_params()
38603860
}
38613861
}
38623862

3863+
ulint min_open_files_limit = srv_undo_tablespaces
3864+
+ srv_sys_space.m_files.size()
3865+
+ srv_tmp_space.m_files.size() + 1;
3866+
if (min_open_files_limit > innobase_open_files) {
3867+
sql_print_warning(
3868+
"InnoDB: innodb_open_files=%lu is not greater "
3869+
"than the number of system tablespace files, "
3870+
"temporary tablespace files, "
3871+
"innodb_undo_tablespaces=%lu; adjusting "
3872+
"to innodb_open_files=%zu",
3873+
innobase_open_files, srv_undo_tablespaces,
3874+
min_open_files_limit);
3875+
innobase_open_files = (ulong) min_open_files_limit;
3876+
}
3877+
38633878
srv_max_n_open_files = innobase_open_files;
38643879
srv_innodb_status = (ibool) innobase_create_status_file;
38653880

0 commit comments

Comments
 (0)