Skip to content

Commit 08bc7ee

Browse files
committed
MDEV-25792 server hangs on early shutdown if InnoDB needs to purge indexed virtual columns
if the server isn't started and innodb initiated a shutdown process - don't wait for the server to start, it won't
1 parent 4777097 commit 08bc7ee

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
call mtr.add_suppression('SQL_ERROR_LOG');
2+
call mtr.add_suppression('Failed to initialize plugins');
3+
call mtr.add_suppression('Aborting');
4+
create table t1(a int primary key, b int as (100-a*a), index(b)) engine=innodb;
5+
insert t1 (a) values(1),(2),(3);
6+
start transaction;
7+
select * from t1 order by a;
8+
a b
9+
1 99
10+
2 96
11+
3 91
12+
connect con1, localhost, root;
13+
delete from t1 where a=2;
14+
flush tables;
15+
connection default;
16+
# Kill the server
17+
# Failed restart
18+
# Start the server
19+
# restart
20+
select * from t1 order by a;
21+
a b
22+
1 99
23+
3 91
24+
drop table t1;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
source include/have_innodb.inc;
2+
# need to restart server
3+
source include/not_embedded.inc;
4+
5+
call mtr.add_suppression('SQL_ERROR_LOG');
6+
call mtr.add_suppression('Failed to initialize plugins');
7+
call mtr.add_suppression('Aborting');
8+
9+
if (!$SQL_ERRLOG_SO) {
10+
skip No SQL_ERROR_LOG plugin;
11+
}
12+
13+
create table t1(a int primary key, b int as (100-a*a), index(b)) engine=innodb;
14+
insert t1 (a) values(1),(2),(3);
15+
start transaction;
16+
select * from t1 order by a;
17+
connect(con1, localhost, root);
18+
delete from t1 where a=2;
19+
flush tables;
20+
connection default;
21+
source include/kill_mysqld.inc;
22+
echo # Failed restart;
23+
error 1;
24+
exec $MYSQLD_LAST_CMD --plugin-load-add=$SQL_ERRLOG_SO --sql-error-log=FORCE --sql-error-log-filename=$MYSQLTEST_VARDIR/nonexistent/nonexistent;
25+
echo # Start the server;
26+
source include/start_mysqld.inc;
27+
select * from t1 order by a;
28+
drop table t1;

storage/innobase/row/row0purge.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ row_purge_parse_undo_rec(
957957
if (!mysqld_server_started) {
958958

959959
node->close_table();
960-
if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
960+
if (srv_shutdown_state > SRV_SHUTDOWN_NONE) {
961961
return(false);
962962
}
963963
os_thread_sleep(1000000);

0 commit comments

Comments
 (0)