Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2.16, 10.0(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
This problem is similar to MDEV-16584, but now for condition handlers.
This script:
DROP PROCEDURE IF EXISTS p1; |
DELIMITER $$
|
CREATE PROCEDURE p1() |
BEGIN
|
DECLARE i INT DEFAULT 1; |
WHILE i <= 500000
|
DO
|
BEGIN |
DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x=1; |
IF (i % 100000 = 0) THEN |
SHOW STATUS LIKE 'Memory_used'; |
END IF; |
END; |
SET i=i+1; |
END WHILE; |
END; |
$$
|
DELIMITER ;
|
CALL p1;
|
returns the following output:
+---------------+---------+
|
| Variable_name | Value |
|
+---------------+---------+
|
| Memory_used | 5664384 |
|
+---------------+---------+
|
1 row in set (2.36 sec)
|
|
+---------------+----------+
|
| Variable_name | Value |
|
+---------------+----------+
|
| Memory_used | 11264384 |
|
+---------------+----------+
|
1 row in set (4.67 sec)
|
|
+---------------+----------+
|
| Variable_name | Value |
|
+---------------+----------+
|
| Memory_used | 16864384 |
|
+---------------+----------+
|
1 row in set (6.96 sec)
|
|
+---------------+----------+
|
| Variable_name | Value |
|
+---------------+----------+
|
| Memory_used | 22464384 |
|
+---------------+----------+
|
1 row in set (9.26 sec)
|
|
+---------------+----------+
|
| Variable_name | Value |
|
+---------------+----------+
|
| Memory_used | 28064384 |
|
+---------------+----------+
|
1 row in set (11.59 sec)
|
Notice, thread memory usage grows through iterations.
Attachments
Issue Links
- relates to
-
MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressively
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
This problem is similar to This script: {code:sql} DROP PROCEDURE IF EXISTS p1; DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE i INT DEFAULT 1; WHILE i <= 500000 DO BEGIN DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x=1; IF (i % 100000 = 0) THEN SHOW STATUS LIKE 'Memory_used'; END IF; END; SET i=i+1; END WHILE; END; $$ DELIMITER ; CALL p1; {code} returns the following output: {noformat} +---------------+---------+ | Variable_name | Value | +---------------+---------+ | Memory_used | 5664384 | +---------------+---------+ 1 row in set (2.36 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 11264384 | +---------------+----------+ 1 row in set (4.67 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 16864384 | +---------------+----------+ 1 row in set (6.96 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 22464384 | +---------------+----------+ 1 row in set (9.26 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 28064384 | +---------------+----------+ 1 row in set (11.59 sec) {noformat} |
This problem is similar to This script: {code:sql} DROP PROCEDURE IF EXISTS p1; DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE i INT DEFAULT 1; WHILE i <= 500000 DO BEGIN DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET @x=1; IF (i % 100000 = 0) THEN SHOW STATUS LIKE 'Memory_used'; END IF; END; SET i=i+1; END WHILE; END; $$ DELIMITER ; CALL p1; {code} returns the following output: {noformat} +---------------+---------+ | Variable_name | Value | +---------------+---------+ | Memory_used | 5664384 | +---------------+---------+ 1 row in set (2.36 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 11264384 | +---------------+----------+ 1 row in set (4.67 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 16864384 | +---------------+----------+ 1 row in set (6.96 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 22464384 | +---------------+----------+ 1 row in set (9.26 sec) +---------------+----------+ | Variable_name | Value | +---------------+----------+ | Memory_used | 28064384 | +---------------+----------+ 1 row in set (11.59 sec) {noformat} Notice, thread memory usage grows through iterations. |
Link |
This issue relates to |
issue.field.resolutiondate | 2018-06-28 12:56:41.0 | 2018-06-28 12:56:41.494 |
Fix Version/s | 10.3.8 [ 23113 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Fix Version/s | 10.4.0 [ 23115 ] |
Workflow | MariaDB v3 [ 88085 ] | MariaDB v4 [ 154577 ] |