-
mithun authored
UNDER THE SAME CONDITIONS. ISSUE : In myisam, Suppose in btree index of varchar type we have keys with and without trailing spaces example keys 'abc', 'abc ', 'abc '. During index search based on same key, length of the lastkey get changed if lastkey read is the one with trailing spaces. If x is the length of key 'abc'. After reading 'abc ' length will be x + 1. And, last_rkey_length should be recalculated as accordingly whenever lastkey changes. But in function mi_rnext_same during BTREE search when we tried to copy lastkey to lastkey2 we have used non updated last_rkey_length even though lastkey and its length might have been changed as explained above. And, last_rkey_length is computed only once during mi_rkey. Because of this invalid length usage compare_key failed and scan got terminated. And, hence Update command ended before updating further tuples which will satisfy the condition. SOLUTION : In function mi_rnext_same the input key lastkey2 can remain constant if we use a separate buffer other than lastkey2. And, we can fill this key just for one time for the complete scan in mi_rnext_same. Since key and length is computed only once for the entire scan, issues related to invalid length during compare keys will not arise.
mithun authoredUNDER THE SAME CONDITIONS. ISSUE : In myisam, Suppose in btree index of varchar type we have keys with and without trailing spaces example keys 'abc', 'abc ', 'abc '. During index search based on same key, length of the lastkey get changed if lastkey read is the one with trailing spaces. If x is the length of key 'abc'. After reading 'abc ' length will be x + 1. And, last_rkey_length should be recalculated as accordingly whenever lastkey changes. But in function mi_rnext_same during BTREE search when we tried to copy lastkey to lastkey2 we have used non updated last_rkey_length even though lastkey and its length might have been changed as explained above. And, last_rkey_length is computed only once during mi_rkey. Because of this invalid length usage compare_key failed and scan got terminated. And, hence Update command ended before updating further tuples which will satisfy the condition. SOLUTION : In function mi_rnext_same the input key lastkey2 can remain constant if we use a separate buffer other than lastkey2. And, we can fill this key just for one time for the complete scan in mi_rnext_same. Since key and length is computed only once for the entire scan, issues related to invalid length during compare keys will not arise.
Loading