Skip to content

Commit 1ea79d1

Browse files
committed
MDEV-35317 Server crashes in mhnsw_insert upon using vector key on a Spider table
don't allow VECTOR indexes in SPIDER tables
1 parent 40d39b1 commit 1ea79d1

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

storage/spider/ha_spider.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void ha_spider::init_fields()
6565
append_tblnm_alias = NULL;
6666
use_index_merge = FALSE;
6767
is_clone = FALSE;
68+
pushed_pos = NULL;
6869
pt_clone_source_handler = NULL;
6970
pt_clone_last_searcher = NULL;
7071
ft_handler = NULL;
@@ -6783,6 +6784,11 @@ int ha_spider::create(
67836784
sql_command == SQLCOM_DROP_INDEX
67846785
)
67856786
DBUG_RETURN(0);
6787+
if (form->s->hlindexes() > 0)
6788+
{
6789+
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), "SPIDER", "VECTOR");
6790+
DBUG_RETURN(HA_ERR_UNSUPPORTED);
6791+
}
67866792
if (!is_supported_parser_charset(info->default_table_charset))
67876793
{
67886794
String charset_option;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
INSTALL SONAME 'ha_spider';
2+
SET spider_same_server_link= ON;
3+
create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_1_MYPORT);
4+
#
5+
# MDEV-35317 Server crashes in mhnsw_insert upon using vector key on a Spider table
6+
#
7+
CREATE TABLE t (v VECTOR(1) NOT NULL, VECTOR(v));
8+
CREATE TABLE t_spider (v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=Spider WRAPPER=mysql REMOTE_TABLE=t REMOTE_SERVER=s;
9+
ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'VECTOR'
10+
INSERT INTO t_spider (v) VALUES (0x30303030);
11+
ERROR 42S02: Table 'test.t_spider' doesn't exist
12+
DROP TABLE t;
13+
DROP FUNCTION IF EXISTS spider_flush_table_mon_cache;
14+
DROP FUNCTION IF EXISTS spider_copy_tables;
15+
DROP FUNCTION IF EXISTS spider_ping_table;
16+
DROP FUNCTION IF EXISTS spider_bg_direct_sql;
17+
DROP FUNCTION IF EXISTS spider_direct_sql;
18+
UNINSTALL SONAME IF EXISTS 'ha_spider';
19+
DROP TABLE IF EXISTS mysql.spider_xa;
20+
DROP TABLE IF EXISTS mysql.spider_xa_member;
21+
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
22+
DROP TABLE IF EXISTS mysql.spider_tables;
23+
DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
24+
DROP TABLE IF EXISTS mysql.spider_link_failed_log;
25+
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
26+
DROP TABLE IF EXISTS mysql.spider_table_sts;
27+
DROP TABLE IF EXISTS mysql.spider_table_crd;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
INSTALL SONAME 'ha_spider';
2+
SET spider_same_server_link= ON;
3+
4+
--evalp create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_1_MYPORT)
5+
6+
--echo #
7+
--echo # MDEV-35317 Server crashes in mhnsw_insert upon using vector key on a Spider table
8+
--echo #
9+
CREATE TABLE t (v VECTOR(1) NOT NULL, VECTOR(v));
10+
11+
#
12+
# For now, SPIDER doesn't support VECTOR indexes.
13+
# When it's fixed, two --error below should be removed
14+
#
15+
--error ER_ILLEGAL_HA_CREATE_OPTION
16+
CREATE TABLE t_spider (v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=Spider WRAPPER=mysql REMOTE_TABLE=t REMOTE_SERVER=s;
17+
--error ER_NO_SUCH_TABLE
18+
INSERT INTO t_spider (v) VALUES (0x30303030);
19+
20+
DROP TABLE t;
21+
--source include/clean_up_spider.inc

0 commit comments

Comments
 (0)