MDEV-34682 Reset spider_hton_ptr in error mode of spider_db_init()

This commit is contained in:
Yuchen Pei 2024-08-02 10:29:08 +10:00
parent 8b51d34462
commit bce3f3f628
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
4 changed files with 39 additions and 5 deletions

View file

@ -0,0 +1,19 @@
set @old_aria_encrypt_tables=@@global.aria_encrypt_tables;
set global aria_encrypt_tables=ON;
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
call mtr.add_suppression(".*\\[ERROR\\] SPIDER plugin initialization failed at.* by 'Initialization of encryption failed for");
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.");
INSTALL PLUGIN spider SONAME 'ha_spider.so';
ERROR HY000: Can't initialize function 'spider'; Plugin initialization function failed.
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
ERROR HY000: Can't initialize function 'spider_direct_sql'; Plugin 'SPIDER' is not loaded
Warnings:
Note 1305 FUNCTION test.spider_flush_table_mon_cache does not exist
Warnings:
Note 1305 FUNCTION test.spider_copy_tables does not exist
Warnings:
Note 1305 FUNCTION test.spider_ping_table does not exist
Warnings:
Note 1305 FUNCTION test.spider_bg_direct_sql does not exist
Warnings:
Note 1305 SONAME ha_spider.so does not exist

View file

@ -0,0 +1,14 @@
set @old_aria_encrypt_tables=@@global.aria_encrypt_tables;
set global aria_encrypt_tables=ON;
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
call mtr.add_suppression(".*\\[ERROR\\] SPIDER plugin initialization failed at.* by 'Initialization of encryption failed for");
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.");
--error ER_CANT_INITIALIZE_UDF
INSTALL PLUGIN spider SONAME 'ha_spider.so';
--error ER_CANT_INITIALIZE_UDF
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
--disable_query_log
--source ../../include/clean_up_spider.inc
set global aria_encrypt_tables=@old_aria_encrypt_tables;

View file

@ -1,8 +1,8 @@
DROP FUNCTION spider_flush_table_mon_cache;
DROP FUNCTION spider_copy_tables;
DROP FUNCTION spider_ping_table;
DROP FUNCTION spider_bg_direct_sql;
DROP FUNCTION spider_direct_sql;
DROP FUNCTION IF EXISTS spider_flush_table_mon_cache;
DROP FUNCTION IF EXISTS spider_copy_tables;
DROP FUNCTION IF EXISTS spider_ping_table;
DROP FUNCTION IF EXISTS spider_bg_direct_sql;
DROP FUNCTION IF EXISTS spider_direct_sql;
UNINSTALL SONAME IF EXISTS 'ha_spider';
DROP TABLE IF EXISTS mysql.spider_xa;
DROP TABLE IF EXISTS mysql.spider_xa_member;

View file

@ -6805,6 +6805,7 @@ error_pt_attr_setstate:
pthread_attr_destroy(&spider_pt_attr);
error_pt_attr_init:
#endif
spider_hton_ptr= NULL;
DBUG_RETURN(error_num);
}