Skip to content

Commit 3dc0cef

Browse files
committed
MDEV-35184 Corruption errors upon creation or usage of Federated table with vector key
disallow vector indexes in FederatedX, both in normal create and in assisted discovery
1 parent ad297c5 commit 3dc0cef

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

mysql-test/suite/federated/federatedx.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,6 +2374,19 @@ a
23742374
DROP VIEW v;
23752375
DROP TABLE t1_fed, t1, t2;
23762376
DROP SERVER s;
2377+
# End of 11.0 tests
2378+
#
2379+
# MDEV-35184 Corruption errors upon creation or usage of Federated table with vector key
2380+
#
2381+
create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_MYPORT);
2382+
create table t1 (a vector(1) not null, vector(a));
2383+
create table t1_fed1 engine=federated connection = 's/t1';
2384+
ERROR HY000: Table storage engine 'FEDERATEDX' does not support the create option 'VECTOR'
2385+
create table t1_fed2 (a vector(1) not null, vector(a)) engine=federated connection = 's/t1';
2386+
ERROR HY000: Table storage engine 'FEDERATEDX' does not support the create option 'VECTOR'
2387+
drop table t1;
2388+
drop server s;
2389+
# End of 11.8 tests
23772390
connection master;
23782391
DROP TABLE IF EXISTS federated.t1;
23792392
DROP DATABASE IF EXISTS federated;

mysql-test/suite/federated/federatedx.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,4 +2112,20 @@ DROP VIEW v;
21122112
DROP TABLE t1_fed, t1, t2;
21132113
DROP SERVER s;
21142114

2115+
--echo # End of 11.0 tests
2116+
2117+
--echo #
2118+
--echo # MDEV-35184 Corruption errors upon creation or usage of Federated table with vector key
2119+
--echo #
2120+
evalp create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_MYPORT);
2121+
create table t1 (a vector(1) not null, vector(a));
2122+
--error ER_ILLEGAL_HA_CREATE_OPTION
2123+
create table t1_fed1 engine=federated connection = 's/t1';
2124+
--error ER_ILLEGAL_HA_CREATE_OPTION
2125+
create table t1_fed2 (a vector(1) not null, vector(a)) engine=federated connection = 's/t1';
2126+
drop table t1;
2127+
drop server s;
2128+
2129+
--echo # End of 11.8 tests
2130+
21152131
source include/federated_cleanup.inc;

storage/federated/ha_federated.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,6 +3128,12 @@ int ha_federated::create(const char *name, TABLE *table_arg,
31283128
FEDERATED_SHARE tmp_share; // Only a temporary share, to test the url
31293129
DBUG_ENTER("ha_federated::create");
31303130

3131+
if (table_arg->s->hlindexes())
3132+
{
3133+
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), "FEDERATED", "VECTOR");
3134+
DBUG_RETURN(HA_ERR_UNSUPPORTED);
3135+
}
3136+
31313137
retval= parse_url(thd->mem_root, &tmp_share, table_arg, 1);
31323138

31333139
DBUG_RETURN(retval);

storage/federatedx/ha_federatedx.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,6 +3403,12 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
34033403
federatedx_io *tmp_io= NULL;
34043404
DBUG_ENTER("ha_federatedx::create");
34053405

3406+
if (table_arg->s->hlindexes())
3407+
{
3408+
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), "FEDERATEDX", "VECTOR");
3409+
DBUG_RETURN(HA_ERR_UNSUPPORTED);
3410+
}
3411+
34063412
if ((retval= parse_url(thd->mem_root, &tmp_share, table_arg->s, 1)))
34073413
goto error;
34083414

@@ -3706,6 +3712,15 @@ int ha_federatedx::discover_assisted(handlerton *hton, THD* thd,
37063712
err1:
37073713
if (error)
37083714
my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), mysql_error(&mysql));
3715+
else if ((error= table_s->hlindexes()))
3716+
{
3717+
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), "FEDERATEDX", "VECTOR");
3718+
char file_name[FN_REFLEN+1];
3719+
strxnmov(file_name, sizeof(file_name)-1, table_s->normalized_path.str,
3720+
reg_ext, NullS);
3721+
my_delete(file_name, MYF(0));
3722+
plugin_unlock(0, table_s->db_plugin);
3723+
}
37093724
mysql_close(&mysql);
37103725
return error;
37113726
}

0 commit comments

Comments
 (0)