summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2006-03-30 01:50:52 +0300
committerunknown <monty@mysql.com>2006-03-30 01:50:52 +0300
commit2d6a51b4c8bac3cbed223836f8b2379b9a065d16 (patch)
tree4989dcdbaa05d835a814af1dbe01ad5166717450 /myisam
parent92df85b43adb2651a74a7178076de4b01cffbdac (diff)
downloadmariadb-git-2d6a51b4c8bac3cbed223836f8b2379b9a065d16.tar.gz
Fix error in prefix compression of keys in MyISAM when key length changed from 254 -> 255
Bug #17705 "FT Index corruption occurs with UTF8 data..." (Actually, the bug had nothing to do with FT index but with general key compression) myisam/mi_search.c: Fix error in prefix compression of keys in MyISAM when key length changed from 254 -> 255 mysql-test/r/ctype_utf8.result: Test of fix for key compression bug mysql-test/t/ctype_utf8.test: Test of fix for key compression bug
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_search.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 9321f5b87d5..517fc9c25ff 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -1456,7 +1456,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if (!*key++)
{
s_temp->key=key;
- s_temp->ref_length=s_temp->key_length=0;
+ s_temp->key_length= 0;
s_temp->totlength=key_length-1+diff_flag;
s_temp->next_key_pos=0; /* No next key */
return (s_temp->totlength);
@@ -1611,12 +1611,12 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->prev_length= org_key_length;
s_temp->n_ref_length=s_temp->n_length= org_key_length;
length+= org_key_length;
- /* +get_pack_length(org_key_length); */
}
return (int) length;
}
ref_length=n_length;
+ /* Get information about not packed key suffix */
get_key_pack_length(n_length,next_length_pack,next_key);
/* Test if new keys has fewer characters that match the previous key */
@@ -1625,7 +1625,6 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->part_of_prev_key= 0;
s_temp->prev_length= ref_length;
s_temp->n_ref_length= s_temp->n_length= n_length+ref_length;
- /* s_temp->prev_key+= get_pack_length(org_key_length); */
return (int) length+ref_length-next_length_pack;
}
if (ref_length+pack_marker > new_ref_length)
@@ -1636,9 +1635,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp->prev_length= ref_length - new_pack_length;
s_temp->n_ref_length=s_temp->n_length=n_length + s_temp->prev_length;
s_temp->prev_key+= new_pack_length;
-/* +get_pack_length(org_key_length); */
- length= length-get_pack_length(ref_length)+
- get_pack_length(new_pack_length);
+ length-= (next_length_pack - get_pack_length(s_temp->n_length));
return (int) length + s_temp->prev_length;
}
}
@@ -1647,7 +1644,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
/* Next key wasn't a prefix of previous key */
ref_length=0;
next_length_pack=0;
- }
+ }
DBUG_PRINT("test",("length: %d next_key: %lx", length,
(long) next_key));