diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/sp-condition-handler.result | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/sp-condition-handler.result')
-rw-r--r-- | mysql-test/main/sp-condition-handler.result | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/main/sp-condition-handler.result b/mysql-test/main/sp-condition-handler.result new file mode 100644 index 00000000..350c5d2b --- /dev/null +++ b/mysql-test/main/sp-condition-handler.result @@ -0,0 +1,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 +# |