1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

BUG#18160 - Memory-/HEAP Table endless growing indexes

Updating data in HEAP table with BTREE index results in wrong index_length
counter value, which keeps growing after each update.

When inserting new record into tree counter is incremented by:
sizeof(TREE_ELEMENT) + key_size + tree->size_of_element
But when deleting element from tree it doesn't decrement counter by key_size:
sizeof(TREE_ELEMENT) + tree->size_of_element

This fix makes accurate allocated memory counter for tree. That is
decrease counter by key_size when deleting tree element.
This commit is contained in:
svoj@april.(none)
2006-04-19 15:13:50 +05:00
parent da6210ee61
commit 06ce215f10
6 changed files with 26 additions and 6 deletions

View File

@@ -164,4 +164,14 @@ DELETE from t1 where a < 100;
SELECT * from t1;
DROP TABLE t1;
#
# BUG#18160 - Memory-/HEAP Table endless growing indexes
#
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
UPDATE t1 SET val=1;
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
DROP TABLE t1;
# End of 4.1 tests