Skip to content

Commit 7f04686

Browse files
committed
MDEV-24049 InnoDB: Failing assertion: node->is_open() in fil_space_t::flush_low
As part of MDEV-23855, we eliminated fil_system.LRU and changed the way how InnoDB data files are opened. We are also enforcing the innodb_open_files limit when new data files are created. The function fil_space_t::flush() would be invoked by row_quiesce_table_start(). If the table was already in clean state, it is possible that the data file is not open. fil_space_t::flush_low(): If the data file is not open, check with a debug assertion that there are no unflushed changes, and carry on. Reviewed by: Eugene Kosov and Thirunarayanan Balathandayuthapani
1 parent e33d452 commit 7f04686

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
SELECT @@GLOBAL.innodb_open_files;
2+
@@GLOBAL.innodb_open_files
3+
10
4+
CREATE TABLE t0 (a INT) ENGINE=InnoDB;
5+
FLUSH TABLE t0 WITH READ LOCK;
6+
UNLOCK TABLES;
7+
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
8+
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
9+
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
10+
CREATE TABLE t4 (a INT) ENGINE=InnoDB;
11+
CREATE TABLE t5 (a INT) ENGINE=InnoDB;
12+
CREATE TABLE t6 (a INT) ENGINE=InnoDB;
13+
CREATE TABLE t7 (a INT) ENGINE=InnoDB;
14+
FLUSH TABLE t0 WITH READ LOCK;
15+
UNLOCK TABLES;
16+
DROP TABLE t0, t1, t2, t3, t4, t5, t6, t7;

mysql-test/suite/innodb/t/flush.opt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--innodb-open-files=10

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--source include/have_innodb.inc
2+
3+
SELECT @@GLOBAL.innodb_open_files;
4+
5+
CREATE TABLE t0 (a INT) ENGINE=InnoDB;
6+
# Ensure that the created table t0 is clean.
7+
FLUSH TABLE t0 WITH READ LOCK;
8+
UNLOCK TABLES;
9+
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
10+
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
11+
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
12+
CREATE TABLE t4 (a INT) ENGINE=InnoDB;
13+
CREATE TABLE t5 (a INT) ENGINE=InnoDB;
14+
CREATE TABLE t6 (a INT) ENGINE=InnoDB;
15+
CREATE TABLE t7 (a INT) ENGINE=InnoDB;
16+
# Now, the data file for t0 should not be open anymore.
17+
FLUSH TABLE t0 WITH READ LOCK;
18+
UNLOCK TABLES;
19+
DROP TABLE t0, t1, t2, t3, t4, t5, t6, t7;

storage/innobase/fil/fil0fil.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,11 @@ inline void fil_space_t::flush_low()
514514
for (fil_node_t *node= UT_LIST_GET_FIRST(chain); node;
515515
node= UT_LIST_GET_NEXT(chain, node))
516516
{
517-
ut_a(node->is_open());
517+
if (!node->is_open())
518+
{
519+
ut_ad(!is_in_unflushed_spaces);
520+
continue;
521+
}
518522
IF_WIN(if (node->is_raw_disk) continue,);
519523
os_file_flush(node->handle);
520524
}

0 commit comments

Comments
 (0)