|
|||||||||||
|
bk commit into 4.1 tree (svoj:1.2680) BUG#30590
From: Sergey Vojtovich <svoj(at)mysql.com>
Date: Thu Aug 30 2007 - 14:56:44 EDT
ChangeSet@1.2680, 2007-08-30 23:47:04+05:00, svoj@april.(none) +4 -0 BUG#30590 - delete from memory table with composite btree primary key DELETE query against memory table with btree index may remove not all matching rows. This happens only when DELETE uses index read method to find matching rows. E.g. for queries like DELETE FROM t1 WHERE a=1. Fixed by reverting fix for BUG9719 and applying proper solution. heap/hp_delete.c@1.15, 2007-08-30 23:47:03+05:00, svoj@april.(none) +0 -3 Reverted fix for BUG9719 as it makes queries like DELETE FROM t1 WHERE a=1 to remove not all matching rows (assuming this is memory table and there is btree key over `a`). This happens because we calculate info->lastkey_len in heap_rkey(). When we enter heap_rnext(), info->lastkey_len is 0 (set by hp_rb_delete_key()). We need to preserve info->lastkey_len in this situation, otherwise tree_search_key() will always return smallest value in a tree.
heap/hp_rfirst.c@1.14, 2007-08-30 23:47:03+05:00, svoj@april.(none) +11 -0
If we're performing index_first on a table that was taken from
table cache, info->lastkey_len and info->last_find_flag are
initialized to previous query. Thus we set info->last_find_flag
and info->lastkey_len to proper values for subsequent heap_rnext()
calls.
mysql-test/r/heap_btree.result@1.22, 2007-08-30 23:47:03+05:00, svoj@april.(none) +7 -0 A test case for BUG#30590. mysql-test/t/heap_btree.test@1.18, 2007-08-30 23:47:03+05:00, svoj@april.(none) +9 -0 A test case for BUG#30590. diff -Nrup a/heap/hp_delete.c b/heap/hp_delete.c --- a/heap/hp_delete.c 2006-08-02 22:06:58 +05:00 +++ b/heap/hp_delete.c 2007-08-30 23:47:03 +05:00@@ -73,10 +73,7 @@ int hp_rb_delete_key(HP_INFO *info, regi int res;
if (flag)
info->last_pos= NULL; /* For heap_rnext/heap_rprev */
- info->lastkey_len= 0;
custom_arg.keyseg= keyinfo->seg;
--- a/heap/hp_rfirst.c 2004-11-22 17:53:12 +04:00
+++ b/heap/hp_rfirst.c 2007-08-30 23:47:03 +05:00
@@ -36,6 +36,17 @@ int heap_rfirst(HP_INFO *info, byte *rec
sizeof(byte*));
info->current_ptr = pos;
memcpy(record, pos, (size_t)share->reclength);
+ /*
@@ -307,4 +307,11 @@ UNIQUE USING BTREE(c1)
) ENGINE= MEMORY DEFAULT CHARSET= utf8;
INSERT INTO t1 VALUES('1'), ('2');
DROP TABLE t1; +CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY; +INSERT INTO t1 VALUES(1),(2),(2); +DELETE FROM t1 WHERE a=2; +SELECT * FROM t1; +a +1 +DROP TABLE t1; End of 4.1 tests diff -Nrup a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test --- a/mysql-test/t/heap_btree.test 2007-03-28 11:51:10 +05:00 +++ b/mysql-test/t/heap_btree.test 2007-08-30 23:47:03 +05:00@@ -213,4 +213,13 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES('1'), ('2'); DROP TABLE t1; +# +# BUG#30590 - delete from memory table with composite btree primary key +# +CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY; +INSERT INTO t1 VALUES(1),(2),(2); +DELETE FROM t1 WHERE a=2; +SELECT * FROM t1; +DROP TABLE t1; + --echo End of 4.1 tests -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Thu Aug 30 15:59:55 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 08:59:38 EDT |
||||||||||
|
|||||||||||