MDEV-35317 Server crashes in mhnsw_insert upon using vector key on a Spider table

don't allow VECTOR indexes in SPIDER tables
This commit is contained in:
Sergei Golubchik 2025-02-03 18:27:13 +01:00
parent 40d39b1176
commit 1ea79d1774
3 changed files with 54 additions and 0 deletions

View file

@ -65,6 +65,7 @@ void ha_spider::init_fields()
append_tblnm_alias = NULL;
use_index_merge = FALSE;
is_clone = FALSE;
pushed_pos = NULL;
pt_clone_source_handler = NULL;
pt_clone_last_searcher = NULL;
ft_handler = NULL;
@ -6783,6 +6784,11 @@ int ha_spider::create(
sql_command == SQLCOM_DROP_INDEX
)
DBUG_RETURN(0);
if (form->s->hlindexes() > 0)
{
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), "SPIDER", "VECTOR");
DBUG_RETURN(HA_ERR_UNSUPPORTED);
}
if (!is_supported_parser_charset(info->default_table_charset))
{
String charset_option;

View file

@ -0,0 +1,27 @@
INSTALL SONAME 'ha_spider';
SET spider_same_server_link= ON;
create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_1_MYPORT);
#
# MDEV-35317 Server crashes in mhnsw_insert upon using vector key on a Spider table
#
CREATE TABLE t (v VECTOR(1) NOT NULL, VECTOR(v));
CREATE TABLE t_spider (v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=Spider WRAPPER=mysql REMOTE_TABLE=t REMOTE_SERVER=s;
ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'VECTOR'
INSERT INTO t_spider (v) VALUES (0x30303030);
ERROR 42S02: Table 'test.t_spider' doesn't exist
DROP TABLE t;
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;
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
DROP TABLE IF EXISTS mysql.spider_tables;
DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
DROP TABLE IF EXISTS mysql.spider_link_failed_log;
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
DROP TABLE IF EXISTS mysql.spider_table_sts;
DROP TABLE IF EXISTS mysql.spider_table_crd;

View file

@ -0,0 +1,21 @@
INSTALL SONAME 'ha_spider';
SET spider_same_server_link= ON;
--evalp create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_1_MYPORT)
--echo #
--echo # MDEV-35317 Server crashes in mhnsw_insert upon using vector key on a Spider table
--echo #
CREATE TABLE t (v VECTOR(1) NOT NULL, VECTOR(v));
#
# For now, SPIDER doesn't support VECTOR indexes.
# When it's fixed, two --error below should be removed
#
--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TABLE t_spider (v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=Spider WRAPPER=mysql REMOTE_TABLE=t REMOTE_SERVER=s;
--error ER_NO_SUCH_TABLE
INSERT INTO t_spider (v) VALUES (0x30303030);
DROP TABLE t;
--source include/clean_up_spider.inc