mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed BUG#51763 Can't delete rows from MEMORY table with HASH key
mysql-test/suite/heap/heap.result: Added test case mysql-test/suite/heap/heap.test: Added test case storage/heap/hp_delete.c: Fixed that we don't change order of keys for the current key when we delete them from the hash table. Fixed that 'current_hash_ptr' is correct after heap_delete_key(). Don't "reset current_hash_ptr" on delete; This will improve time a lot for delete of rows when not all rows matches the search criteria.
This commit is contained in:
@@ -790,3 +790,22 @@ select data_length,index_length from information_schema.tables where table_schem
|
||||
data_length index_length
|
||||
81024 121024
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
color enum('GREEN', 'WHITE') DEFAULT NULL,
|
||||
ts int,
|
||||
PRIMARY KEY (id),
|
||||
KEY color (color) USING HASH
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 VALUES("1","GREEN",1);
|
||||
INSERT INTO t1 VALUES("2","GREEN",1);
|
||||
INSERT INTO t1 VALUES("3","GREEN",1);
|
||||
INSERT INTO t1 VALUES("4","GREEN",1);
|
||||
INSERT INTO t1 VALUES("5","GREEN",1);
|
||||
INSERT INTO t1 VALUES("6","GREEN",1);
|
||||
DELETE FROM t1 WHERE id = 1;
|
||||
INSERT INTO t1 VALUES("7","GREEN", 2);
|
||||
DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
|
||||
SELECT * from t1 WHERE ts = 1 AND color = 'GREEN';
|
||||
id color ts
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -537,3 +537,27 @@ insert into t1 select rand(100000000) from t1;
|
||||
--replace_result 40512 81024 60512 121024
|
||||
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#51763 Can't delete rows from MEMORY table with HASH key
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
color enum('GREEN', 'WHITE') DEFAULT NULL,
|
||||
ts int,
|
||||
PRIMARY KEY (id),
|
||||
KEY color (color) USING HASH
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO t1 VALUES("1","GREEN",1);
|
||||
INSERT INTO t1 VALUES("2","GREEN",1);
|
||||
INSERT INTO t1 VALUES("3","GREEN",1);
|
||||
INSERT INTO t1 VALUES("4","GREEN",1);
|
||||
INSERT INTO t1 VALUES("5","GREEN",1);
|
||||
INSERT INTO t1 VALUES("6","GREEN",1);
|
||||
DELETE FROM t1 WHERE id = 1;
|
||||
INSERT INTO t1 VALUES("7","GREEN", 2);
|
||||
DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
|
||||
SELECT * from t1 WHERE ts = 1 AND color = 'GREEN';
|
||||
DROP TABLE t1;
|
||||
|
||||
Reference in New Issue
Block a user