blob: 350c5d2bd3d743abc6b245cdad2a5e19e1116e31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#
# Start of 10.3 tests
#
#
# MDEV-16595 SP with a CONTINUE HANDLER inside a loop wastes THD memory aggressively
#
CREATE PROCEDURE p1()
BEGIN
DECLARE mem_used_old BIGINT UNSIGNED DEFAULT
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME='MEMORY_USED');
DECLARE i INT DEFAULT 1;
WHILE i <= 1000
DO
BEGIN
DECLARE msg TEXT;
DECLARE mem_used_cur BIGINT UNSIGNED DEFAULT
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME='MEMORY_USED');
DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23001' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23002' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23003' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23004' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23005' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23006' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23007' SET @x=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23008' SET @x=1;
IF (mem_used_cur >= mem_used_old * 1.1) THEN
SHOW STATUS LIKE 'Memory_used';
SET msg=CONCAT('Memory leak detected: i=', i, ' mem_used_old=',mem_used_old,' mem_used_cur=', mem_used_cur);
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT=msg;
END IF;
END;
SET i=i+1;
END WHILE;
END;
$$
CALL p1;
DROP PROCEDURE p1;
#
# End of 10.3 tests
#
|