Skip to content

Commit 2f5e53f

Browse files
grooverdanThirunarayanan
authored andcommitted
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 onny.
1 parent 58469dd commit 2f5e53f

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
@@ -4379,6 +4379,8 @@ innobase_end(handlerton*, ha_panic_function)
43794379
innodb_shutdown();
43804380
mysql_mutex_destroy(&log_requests.mutex);
43814381
}
4382+
else
4383+
buf_mem_pressure_shutdown();
43824384

43834385
DBUG_RETURN(0);
43844386
}

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 mem 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
@@ -2120,12 +2120,6 @@ void log_free_check() noexcept
21202120
log_sys.checkpoint_margin();
21212121
}
21222122

2123-
#ifdef __linux__
2124-
extern void buf_mem_pressure_shutdown() noexcept;
2125-
#else
2126-
inline void buf_mem_pressure_shutdown() noexcept {}
2127-
#endif
2128-
21292123
/** Make a checkpoint at the latest lsn on shutdown.
21302124
@return the shutdown LSN */
21312125
ATTRIBUTE_COLD lsn_t logs_empty_and_mark_files_at_shutdown() noexcept

0 commit comments

Comments
 (0)