Skip to content

Commit ce10161

Browse files
committed
MDEV-39541 mem_pressure::~mem_pressure() causes a crash on bootstrap
Fill in the anomaly shutdown paths of InnoDB to include call to buf_mem_pressure_shutdown now that MDEV-39585 provides some proper calls shutdown InnoDB and other plugins during the shutdown under --bootstrap. Alternate: destructor attribute on buf_mem_pressure_shutdown would acheive the same thing and given Linux compilers are capabile of this. This is possible as mem_pressure is currently implemented in Linux only.
1 parent 9e240a3 commit ce10161

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
create table t1(a int) engine=innodb;
2+
#
3+
# MDEV-39541 mem_pressure::~mem_pressure() causes a crash on bootstrap
4+
#
25
# restart
36
select * from t1;
47
a
58
1
69
2
710
5
811
drop table t1;
12+
# End of 10.11 tests

mysql-test/main/bootstrap_innodb.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ EOF
2222
exec $MYSQLD_BOOTSTRAP_CMD --datadir=$datadir --tmpdir=$MYSQL_TMP_DIR --innodb < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1;
2323
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
2424

25+
--echo #
26+
--echo # MDEV-39541 mem_pressure::~mem_pressure() causes a crash on bootstrap
27+
--echo #
28+
29+
write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
30+
SHUTDOWN;
31+
EOF
32+
exec $MYSQLD_BOOTSTRAP_CMD --datadir=$datadir --tmpdir=$MYSQL_TMP_DIR --innodb < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1;
33+
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
34+
2535
source include/start_mysqld.inc;
2636
select * from t1;
2737
drop table t1;
38+
39+
--echo # End of 10.11 tests

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,6 +4273,8 @@ innobase_end(handlerton*, ha_panic_function)
42734273
innodb_shutdown();
42744274
mysql_mutex_destroy(&log_requests.mutex);
42754275
}
4276+
else
4277+
buf_mem_pressure_shutdown();
42764278

42774279
DBUG_RETURN(0);
42784280
}

storage/innobase/include/srv0start.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ void innodb_preshutdown();
5252
/** Shut down InnoDB. */
5353
void innodb_shutdown();
5454

55+
/** Stop memory presure thread and free file descriptors */
56+
#ifdef __linux__
57+
void buf_mem_pressure_shutdown() noexcept;
58+
#else
59+
inline void buf_mem_pressure_shutdown() noexcept {}
60+
#endif
5561
/*************************************************************//**
5662
Copy the file path component of the physical file to parameter. It will
5763
copy up to and including the terminating path separator.

storage/innobase/log/log0log.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,12 +1351,6 @@ void log_free_check() noexcept
13511351
}
13521352
}
13531353

1354-
#ifdef __linux__
1355-
extern void buf_mem_pressure_shutdown() noexcept;
1356-
#else
1357-
inline void buf_mem_pressure_shutdown() noexcept {}
1358-
#endif
1359-
13601354
/** Make a checkpoint at the latest lsn on shutdown.
13611355
@return the shutdown LSN */
13621356
ATTRIBUTE_COLD lsn_t logs_empty_and_mark_files_at_shutdown() noexcept

0 commit comments

Comments
 (0)