mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-34169 Don't allow innodb_open_files to be lesser than
number of non-user tablespace. fil_space_t::try_to_close(): Don't try to close the tablespace which is acquired by the caller of the function Added the suppression message in open_files_limit test case
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
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=.*");
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: innodb_open_files=.* is exceeded \\(.* files stay open\\)");
|
||||
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
|
||||
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
|
||||
DROP TABLE t1;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
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=.*");
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: innodb_open_files=.* is exceeded \\(.* files stay open\\)");
|
||||
let SEARCH_PATTERN= \[Warning\] InnoDB: innodb_open_files=.* is not greater than the number of system tablespace files, temporary tablespace files, innodb_undo_tablespaces=.*;
|
||||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
@@ -66,9 +66,10 @@ inline bool fil_is_user_tablespace_id(ulint space_id)
|
||||
}
|
||||
|
||||
/** Try to close a file to adhere to the innodb_open_files limit.
|
||||
@param ignore_space Ignore the tablespace which is acquired by caller
|
||||
@param print_info whether to diagnose why a file cannot be closed
|
||||
@return whether a file was closed */
|
||||
bool fil_space_t::try_to_close(bool print_info)
|
||||
bool fil_space_t::try_to_close(fil_space_t *ignore_space, bool print_info)
|
||||
{
|
||||
ut_ad(mutex_own(&fil_system.mutex));
|
||||
for (fil_space_t *space= UT_LIST_GET_FIRST(fil_system.space_list); space;
|
||||
@@ -80,7 +81,8 @@ bool fil_space_t::try_to_close(bool print_info)
|
||||
case FIL_TYPE_IMPORT:
|
||||
break;
|
||||
case FIL_TYPE_TABLESPACE:
|
||||
if (!fil_is_user_tablespace_id(space->id))
|
||||
if (space == ignore_space
|
||||
|| !fil_is_user_tablespace_id(space->id))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -354,7 +356,7 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle,
|
||||
n_pending.fetch_and(~CLOSING, std::memory_order_relaxed);
|
||||
if (++fil_system.n_open >= srv_max_n_open_files) {
|
||||
reacquire();
|
||||
try_to_close(true);
|
||||
try_to_close(this, true);
|
||||
release();
|
||||
}
|
||||
}
|
||||
@@ -405,7 +407,7 @@ static bool fil_node_open_file_low(fil_node_t *node)
|
||||
|
||||
/* The following call prints an error message */
|
||||
if (os_file_get_last_error(true) == EMFILE + 100 &&
|
||||
fil_space_t::try_to_close(true))
|
||||
fil_space_t::try_to_close(nullptr, true))
|
||||
continue;
|
||||
|
||||
ib::warn() << "Cannot open '" << node->name << "'.";
|
||||
@@ -449,7 +451,7 @@ static bool fil_node_open_file(fil_node_t *node)
|
||||
|
||||
for (ulint count= 0; fil_system.n_open >= srv_max_n_open_files; count++)
|
||||
{
|
||||
if (fil_space_t::try_to_close(count > 1))
|
||||
if (fil_space_t::try_to_close(nullptr, count > 1))
|
||||
count= 0;
|
||||
else if (count >= 2)
|
||||
{
|
||||
|
@@ -590,9 +590,10 @@ private:
|
||||
|
||||
public:
|
||||
/** Try to close a file to adhere to the innodb_open_files limit.
|
||||
@param ignore_space Ignore the tablespace which is acquired by caller
|
||||
@param print_info whether to diagnose why a file cannot be closed
|
||||
@return whether a file was closed */
|
||||
static bool try_to_close(bool print_info);
|
||||
static bool try_to_close(fil_space_t *ignore_space, bool print_info);
|
||||
|
||||
/** Close all tablespace files at shutdown */
|
||||
static void close_all();
|
||||
|
Reference in New Issue
Block a user