summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-05-17 18:34:22 +0200
committerSergei Golubchik <serg@mariadb.org>2020-07-29 14:56:24 +0200
commit88cbe2f08193054ccf6565c2b27a8d809285a45b (patch)
tree8978eb8429fcaf81593a789d372babb4192e5ef2
parente6cb263ef3ecc59510b62f7c7dd5dfcd78a613c7 (diff)
downloadmariadb-git-88cbe2f08193054ccf6565c2b27a8d809285a45b.tar.gz
MDEV-18496 Crash when Aria encryption is enabled but plugin not available
wait_while_table_is_used() should return an error if handler::extra() fails
-rw-r--r--mysql-test/suite/maria/encrypt-no-key.result9
-rw-r--r--mysql-test/suite/maria/encrypt-no-key.test13
-rw-r--r--sql/sql_base.cc2
-rw-r--r--storage/myisammrg/myrg_extra.c2
4 files changed, 24 insertions, 2 deletions
diff --git a/mysql-test/suite/maria/encrypt-no-key.result b/mysql-test/suite/maria/encrypt-no-key.result
new file mode 100644
index 00000000000..4d15725648f
--- /dev/null
+++ b/mysql-test/suite/maria/encrypt-no-key.result
@@ -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;
diff --git a/mysql-test/suite/maria/encrypt-no-key.test b/mysql-test/suite/maria/encrypt-no-key.test
new file mode 100644
index 00000000000..ff2190f5a6e
--- /dev/null
+++ b/mysql-test/suite/maria/encrypt-no-key.test
@@ -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;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3533c241fbc..76aab377985 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -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);
}
diff --git a/storage/myisammrg/myrg_extra.c b/storage/myisammrg/myrg_extra.c
index 43dfc18c710..2b3861b9f7f 100644
--- a/storage/myisammrg/myrg_extra.c
+++ b/storage/myisammrg/myrg_extra.c
@@ -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;