| 1 |
# |
| 2 |
# BUG 31222046 - .IDB GROWS INDEFENITELY (BUG #96466 WITH REPLACE) |
| 3 |
# |
| 4 |
SET GLOBAL innodb_compression_level = 0; |
| 5 |
CREATE TABLE `my_sample_table` |
| 6 |
(`id` INT NOT NULL AUTO_INCREMENT, |
| 7 |
`name` VARCHAR(128) NOT NULL, |
| 8 |
`some_data` MEDIUMBLOB, |
| 9 |
`update_time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| 10 |
PRIMARY KEY (`id`), |
| 11 |
UNIQUE KEY `name` (`name`)) ROW_FORMAT=COMPRESSED; |
| 12 |
CREATE PROCEDURE p(p_num INT) |
| 13 |
BEGIN |
| 14 |
DECLARE v_i INT DEFAULT 0; |
| 15 |
REPEAT |
| 16 |
REPLACE INTO my_sample_table (id, name, some_data) VALUES (1, 'data1', REPEAT('x',7609)); |
| 17 |
REPLACE INTO my_sample_table (id, name, some_data) VALUES (1, 'data1', REPEAT('t', 4184950)); |
| 18 |
SET v_i:=v_i+1; |
| 19 |
UNTIL v_i>p_num END REPEAT; |
| 20 |
END $ |
| 21 |
REPLACE INTO my_sample_table (id, name, some_data) VALUES (1, 'data1', REPEAT('t', 4184950)); |
| 22 |
START TRANSACTION; |
| 23 |
CALL p(30); |
| 24 |
COMMIT; |
| 25 |
FLUSH TABLES `my_sample_table` FOR EXPORT; |
| 26 |
UNLOCK TABLES; |
| 27 |
SET @fs1 = (SELECT file_size FROM information_schema.innodb_tablespaces |
| 28 |
WHERE name = 'test/my_sample_table'); |
| 29 |
START TRANSACTION; |
| 30 |
CALL p(30); |
| 31 |
COMMIT; |
| 32 |
FLUSH TABLES `my_sample_table` FOR EXPORT; |
| 33 |
UNLOCK TABLES; |
| 34 |
SET @fs2 = (SELECT file_size FROM information_schema.innodb_tablespaces |
| 35 |
WHERE name = 'test/my_sample_table'); |
| 36 |
SET @growing = (SELECT (@fs2 - @fs1)); |
| 37 |
SELECT @growing; |
| 38 |
@growing |
| 39 |
0 |
| 40 |
START TRANSACTION; |
| 41 |
CALL p(30); |
| 42 |
ROLLBACK; |
| 43 |
FLUSH TABLES `my_sample_table` FOR EXPORT; |
| 44 |
UNLOCK TABLES; |
| 45 |
SET @fs3 = (SELECT file_size FROM information_schema.innodb_tablespaces |
| 46 |
WHERE name = 'test/my_sample_table'); |
| 47 |
SET @growing = (SELECT (@fs3 - @fs2)); |
| 48 |
SELECT @growing; |
| 49 |
@growing |
| 50 |
0 |
| 51 |
DROP PROCEDURE p; |
| 52 |
DROP TABLE my_sample_table; |
| 53 |
SET GLOBAL innodb_compression_level = DEFAULT; |