Commit 47fa576d authored by Nikita Malyavin's avatar Nikita Malyavin

MDEV-34164 Server crashes during OPTIMIZE/REPAIR for InnoDB temporary tables

Caused by:
5d37cac7 MDEV-33348 ALTER TABLE lock waiting stages are indistinguishable.

In that commit, progress reporting was moved to
mysql_alter_table from copy_data_between_tables.

The temporary table case wasn't taken into the consideration,
where the execution of mysql_alter_table ends earlier than usual, by the
'end_temporary' label. There, thd_progress_end has been missing.

Fix:
Add missing thd_progress_end() call in mysql_alter_table.
parent 2455f1a9
......@@ -260,4 +260,35 @@ rollback;
connection default;
drop table t1;
disconnect con2;
# MDEV-34164 Server crashes when executing OPTIMIZE or REPAIR TABLE for InnoDB temporary tables
create temporary table t1 (i int) engine=innodb;
create table t2 (i int) engine=aria ;
optimize table t1,t2;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
test.t2 optimize status Table is already up to date
drop table t1,t2;
create temporary table t1 (f int) engine=innodb;
create temporary table t2 (f int) engine=innodb;
optimize local table t1,t2;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
test.t2 optimize status OK
drop table t1,t2;
set @save_sql_mode = @@sql_mode;
set sql_mode= '';
create temporary table t (c decimal zerofill,c2 int zerofill,c3 char binary,key(c)) engine=innodb;
insert into t values (1,1,1);
set session enforce_storage_engine=aria;
optimize no_write_to_binlog table t;
Table Op Msg_type Msg_text
test.t optimize note Table does not support optimize, doing recreate + analyze instead
test.t optimize status OK
Warnings:
Note 1266 Using storage engine Aria for table 't'
drop table t;
set sql_mode= @save_sql_mode;
# End of 11.2 tests
......@@ -282,4 +282,25 @@ drop table t1;
--disconnect con2
--enable_view_protocol
--echo # MDEV-34164 Server crashes when executing OPTIMIZE or REPAIR TABLE for InnoDB temporary tables
create temporary table t1 (i int) engine=innodb;
create table t2 (i int) engine=aria ;
optimize table t1,t2;
drop table t1,t2;
create temporary table t1 (f int) engine=innodb;
create temporary table t2 (f int) engine=innodb;
optimize local table t1,t2;
drop table t1,t2;
set @save_sql_mode = @@sql_mode;
set sql_mode= '';
create temporary table t (c decimal zerofill,c2 int zerofill,c3 char binary,key(c)) engine=innodb;
insert into t values (1,1,1);
set session enforce_storage_engine=aria;
optimize no_write_to_binlog table t;
drop table t;
set sql_mode= @save_sql_mode;
--echo # End of 11.2 tests
......@@ -11835,6 +11835,7 @@ do_continue:;
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
thd_progress_end(thd);
*recreate_info= Recreate_info(copied, deleted);
thd->my_ok_with_recreate_info(*recreate_info,
(ulong) thd->get_stmt_da()->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment