Commit d3c2c0d1 authored by Sergey Vojtovich's avatar Sergey Vojtovich Committed by Sergei Golubchik

Fixed TRUNCATE TABLE against VECTOR indexes

This patch fixes only TRUNCATE by recreate variant, there seem to be no
reasonable engine that uses TRUNCATE by handler method for testing.

Reset index_cinfo so that mi_create is not confused by garbage passed via
index_file_name and sets MY_DELETE_OLD flag.

Review question: can we add a test case to make sure VECTOR index is empty
indeed?
parent ca002ec4
......@@ -302,3 +302,19 @@ id hex(v)
20 6CA1D43E9DF91B3FE580DA3E1C247D3F147CF33E
drop table t1, t2;
db.opt
create table t1 (id int auto_increment primary key, v blob not null, vector index (v));
truncate table t1;
insert t1 (v) values (x'e360d63ebe554f3fcdbc523f4522193f5236083d');
truncate table t1;
select * from t1;
id v
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`v` blob NOT NULL,
PRIMARY KEY (`id`),
VECTOR KEY `v` (`v`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
db.opt
......@@ -101,3 +101,13 @@ insert into t1 select * from t2;
select id, hex(v) from t1;
drop table t1, t2;
list_files $datadir/test;
create table t1 (id int auto_increment primary key, v blob not null, vector index (v));
truncate table t1;
insert t1 (v) values (x'e360d63ebe554f3fcdbc523f4522193f5236083d');
truncate table t1;
select * from t1;
replace_result InnoDB MyISAM;
show create table t1;
drop table t1;
list_files $datadir/test;
......@@ -6421,6 +6421,7 @@ int ha_create_table(THD *thd, const char *path, const char *db,
HA_CREATE_INFO index_cinfo;
char *path_end= strmov(file_name, path);
bzero((char*) &index_cinfo, sizeof(index_cinfo));
index_cinfo.alter_info= &index_ainfo;
if ((error= share.path.length > sizeof(file_name) - HLINDEX_BUF_LEN))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment