Commit cb9e23bb authored by Sergey Vojtovich's avatar Sergey Vojtovich

Merge.

parents 93f2daf3 3f9cbd77
......@@ -118,3 +118,35 @@ Aborted: file is not compressed
DROP TABLE t1,t2,t3;
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;
#
# BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES
#
CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc');
FLUSH TABLE t1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE);
a
aaaa
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa');
a
aaaa
DROP TABLE t1;
# Test table with key_reflength > rec_reflength
CREATE TABLE t1(a CHAR(30), FULLTEXT(a));
# Populating a table, so it's index file exceeds 65K
# Populating a table, so index file has second level fulltext tree
FLUSH TABLE t1;
# Compressing table
# Fixing index (repair by sort)
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
FLUSH TABLE t1;
# Fixing index (repair with keycache)
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
......@@ -221,3 +221,47 @@ DROP TABLE t1,t2,t3;
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;
--echo #
--echo # BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES
--echo #
CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc');
FLUSH TABLE t1;
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
--exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1
CHECK TABLE t1;
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa');
DROP TABLE t1;
--echo # Test table with key_reflength > rec_reflength
CREATE TABLE t1(a CHAR(30), FULLTEXT(a));
--disable_query_log
--echo # Populating a table, so it's index file exceeds 65K
let $1=1700;
while ($1)
{
eval INSERT INTO t1 VALUES('$1aaaaaaaaaaaaaaaaaaaaaaaaaa');
dec $1;
}
--echo # Populating a table, so index file has second level fulltext tree
let $1=60;
while ($1)
{
eval INSERT INTO t1 VALUES('aaaa'),('aaaa'),('aaaa'),('aaaa'),('aaaa');
dec $1;
}
--enable_query_log
FLUSH TABLE t1;
--echo # Compressing table
--exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
--echo # Fixing index (repair by sort)
--exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
CHECK TABLE t1;
FLUSH TABLE t1;
--echo # Fixing index (repair with keycache)
--exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1
CHECK TABLE t1;
DROP TABLE t1;
......@@ -360,7 +360,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
int subkeys=1;
my_bool can_go_down;
MI_INFO *info=ftb->info;
uint UNINIT_VAR(off), extra=HA_FT_WLEN+info->s->base.rec_reflength;
uint UNINIT_VAR(off), extra= HA_FT_WLEN + info->s->rec_reflength;
uchar *lastkey_buf=ftbw->word+ftbw->off;
if (ftbw->flags & FTB_FLAG_TRUNC)
......
......@@ -72,7 +72,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
uchar *keybuff=aio->keybuff;
MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr;
my_off_t key_root=info->s->state.key_root[aio->keynr];
uint extra=HA_FT_WLEN+info->s->base.rec_reflength;
uint extra= HA_FT_WLEN + info->s->rec_reflength;
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
float tmp_weight;
#else
......
......@@ -3899,7 +3899,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
SORT_FT_BUF *ft_buf=sort_info->ft_buf;
SORT_KEY_BLOCKS *key_block=sort_info->key_block;
val_len=HA_FT_WLEN+sort_info->info->s->base.rec_reflength;
val_len= HA_FT_WLEN + sort_info->info->s->rec_reflength;
get_key_full_length_rdonly(a_len, (uchar *)a);
if (!ft_buf)
......@@ -3909,7 +3909,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
and row format is NOT static - for _mi_dpointer not to garble offsets
*/
if ((sort_info->info->s->base.key_reflength <=
sort_info->info->s->base.rec_reflength) &&
sort_info->info->s->rec_reflength) &&
(sort_info->info->s->options &
(HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)))
ft_buf=(SORT_FT_BUF *)my_malloc(sort_param->keyinfo->block_length +
......
......@@ -519,7 +519,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
if (keyinfo->block_length - a_length < 32 &&
keyinfo->flag & HA_FULLTEXT && key_pos == endpos &&
info->s->base.key_reflength <= info->s->base.rec_reflength &&
info->s->base.key_reflength <= info->s->rec_reflength &&
info->s->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD))
{
/*
......
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