Skip to content

Commit

Permalink
MDEV-18496 Crash when Aria encryption is enabled but plugin not avail…
Browse files Browse the repository at this point in the history
…able

wait_while_table_is_used() should return an error if handler::extra() fails
  • Loading branch information
vuvova committed Jul 29, 2020
1 parent e6cb263 commit 88cbe2f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
9 changes: 9 additions & 0 deletions mysql-test/suite/maria/encrypt-no-key.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
call mtr.add_suppression('Unknown key id 1. Can''t continue');
set global aria_encrypt_tables= 1;
create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1;
alter table t1 disable keys;
insert into t1 values (1,1);
alter table t1 enable keys;
ERROR HY000: Unknown key id 1. Can't continue!
drop table t1;
set global aria_encrypt_tables= default;
13 changes: 13 additions & 0 deletions mysql-test/suite/maria/encrypt-no-key.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# MDEV-18496 Crash when Aria encryption is enabled but plugin not available
#
call mtr.add_suppression('Unknown key id 1. Can''t continue');

set global aria_encrypt_tables= 1;
create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1;
alter table t1 disable keys;
insert into t1 values (1,1);
error 192;
alter table t1 enable keys;
drop table t1;
set global aria_encrypt_tables= default;
2 changes: 1 addition & 1 deletion sql/sql_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
FALSE);
/* extra() call must come only after all instances above are closed */
if (function != HA_EXTRA_NOT_USED)
(void) table->file->extra(function);
DBUG_RETURN(table->file->extra(function));
DBUG_RETURN(FALSE);
}

Expand Down
2 changes: 1 addition & 1 deletion storage/myisammrg/myrg_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int myrg_extra(MYRG_INFO *info,enum ha_extra_function function,
DBUG_PRINT("info",("function: %lu", (ulong) function));

if (!info->children_attached)
DBUG_RETURN(1);
DBUG_RETURN(0);
if (function == HA_EXTRA_CACHE)
{
info->cache_in_use=1;
Expand Down

0 comments on commit 88cbe2f

Please sign in to comment.