mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
bug#6784
mi_flush_bulk_insert (on dup key error in mi_write) was mangling info->dupp_key_pos
This commit is contained in:
@ -165,12 +165,7 @@ err:
|
|||||||
{
|
{
|
||||||
uint j;
|
uint j;
|
||||||
for (j=0 ; j < share->base.keys ; j++)
|
for (j=0 ; j < share->base.keys ; j++)
|
||||||
{
|
mi_flush_bulk_insert(info, j);
|
||||||
if (is_tree_inited(&info->bulk_insert[j]))
|
|
||||||
{
|
|
||||||
reset_tree(&info->bulk_insert[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
info->errkey= (int) i;
|
info->errkey= (int) i;
|
||||||
while ( i-- > 0)
|
while ( i-- > 0)
|
||||||
@ -329,7 +324,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||||||
uchar *temp_buff,*keypos;
|
uchar *temp_buff,*keypos;
|
||||||
uchar keybuff[MI_MAX_KEY_BUFF];
|
uchar keybuff[MI_MAX_KEY_BUFF];
|
||||||
my_bool was_last_key;
|
my_bool was_last_key;
|
||||||
my_off_t next_page;
|
my_off_t next_page, dupp_key_pos;
|
||||||
DBUG_ENTER("w_search");
|
DBUG_ENTER("w_search");
|
||||||
DBUG_PRINT("enter",("page: %ld",page));
|
DBUG_PRINT("enter",("page: %ld",page));
|
||||||
|
|
||||||
@ -349,9 +344,9 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||||||
/* get position to record with duplicated key */
|
/* get position to record with duplicated key */
|
||||||
tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,keybuff);
|
tmp_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,keybuff);
|
||||||
if (tmp_key_length)
|
if (tmp_key_length)
|
||||||
info->dupp_key_pos=_mi_dpos(info,0,keybuff+tmp_key_length);
|
dupp_key_pos=_mi_dpos(info,0,keybuff+tmp_key_length);
|
||||||
else
|
else
|
||||||
info->dupp_key_pos= HA_OFFSET_ERROR;
|
dupp_key_pos= HA_OFFSET_ERROR;
|
||||||
if (keyinfo->flag & HA_FULLTEXT)
|
if (keyinfo->flag & HA_FULLTEXT)
|
||||||
{
|
{
|
||||||
uint off;
|
uint off;
|
||||||
@ -370,7 +365,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* popular word. two-level tree. going down */
|
/* popular word. two-level tree. going down */
|
||||||
my_off_t root=info->dupp_key_pos;
|
my_off_t root=dupp_key_pos;
|
||||||
keyinfo=&info->s->ft2_keyinfo;
|
keyinfo=&info->s->ft2_keyinfo;
|
||||||
get_key_full_length_rdonly(off, key);
|
get_key_full_length_rdonly(off, key);
|
||||||
key+=off;
|
key+=off;
|
||||||
@ -389,6 +384,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||||||
}
|
}
|
||||||
else /* not HA_FULLTEXT, normal HA_NOSAME key */
|
else /* not HA_FULLTEXT, normal HA_NOSAME key */
|
||||||
{
|
{
|
||||||
|
info->dupp_key_pos= dupp_key_pos;
|
||||||
my_afree((byte*) temp_buff);
|
my_afree((byte*) temp_buff);
|
||||||
my_errno=HA_ERR_FOUND_DUPP_KEY;
|
my_errno=HA_ERR_FOUND_DUPP_KEY;
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
@ -399,3 +399,9 @@ select count(*) from t1;
|
|||||||
count(*)
|
count(*)
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a int primary key, b text, fulltext(b));
|
||||||
|
create table t2 (a int, b text);
|
||||||
|
insert t1 values (1, "aaaa"), (2, "bbbb");
|
||||||
|
insert t2 values (10, "aaaa"), (2, "cccc");
|
||||||
|
replace t1 select * from t2;
|
||||||
|
drop table t1, t2;
|
||||||
|
@ -308,3 +308,16 @@ REPAIR TABLE t1;
|
|||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# bug#6784
|
||||||
|
# mi_flush_bulk_insert (on dup key error in mi_write)
|
||||||
|
# was mangling info->dupp_key_pos
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (a int primary key, b text, fulltext(b));
|
||||||
|
create table t2 (a int, b text);
|
||||||
|
insert t1 values (1, "aaaa"), (2, "bbbb");
|
||||||
|
insert t2 values (10, "aaaa"), (2, "cccc");
|
||||||
|
replace t1 select * from t2;
|
||||||
|
drop table t1, t2;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user