1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-20842 Crash using versioning plugin functions after plugin was removed from server

Remove plugin functions via item_create_remove() at deinit time.
This commit is contained in:
Aleksey Midenkov
2021-04-24 09:06:16 +03:00
parent 6d73282b13
commit 23e090626a
5 changed files with 30 additions and 1 deletions

View File

@ -506,3 +506,9 @@ add period for system_time(`row_start`,`row_end`),
modify x int after row_start,
with system versioning;
create or replace database test;
#
# MDEV-20842 Crash using versioning plugin functions after plugin was removed from server
#
uninstall plugin test_versioning;
select trt_begin_ts(0);
ERROR 42000: FUNCTION trt_begin_ts does not exist

View File

@ -529,5 +529,11 @@ alter table t add `row_start` bigint unsigned as row start,
modify x int after row_start,
with system versioning;
create or replace database test;
--echo #
--echo # MDEV-20842 Crash using versioning plugin functions after plugin was removed from server
--echo #
uninstall plugin test_versioning;
--error ER_SP_DOES_NOT_EXIST
select trt_begin_ts(0);

View File

@ -175,6 +175,7 @@ static int versioning_plugin_init(void *p __attribute__ ((unused)))
static int versioning_plugin_deinit(void *p __attribute__ ((unused)))
{
DBUG_ENTER("versioning_plugin_deinit");
(void) item_create_remove(func_array);
DBUG_RETURN(0);
}

View File

@ -7465,6 +7465,21 @@ int item_create_append(Native_func_registry array[])
DBUG_RETURN(0);
}
int item_create_remove(Native_func_registry array[])
{
Native_func_registry *func;
DBUG_ENTER("item_create_remove");
for (func= array; func->builder != NULL; func++)
{
if (my_hash_delete(& native_functions_hash, (uchar*) func))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
/*
Empty the hash table for native functions.
Note: this code is not thread safe, and is intended to be used at server

View File

@ -214,6 +214,7 @@ struct Native_func_registry
int item_create_init();
int item_create_append(Native_func_registry array[]);
int item_create_remove(Native_func_registry array[]);
void item_create_cleanup();
Item *create_func_dyncol_create(THD *thd, List<DYNCALL_CREATE_DEF> &list);