MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
The discovered memory leak was introduced by the commit 762bf7a03b6214f091a66ca8683df341112d7d4a (MDEV-22602 Disable UPDATE CASCADE for SQL constraints) The reason why a memory leaked on running the test main.constraints is that a statement arena was used for allocation a memory for storing a constraint name. A constraint name is an entity having temporary nature by its design so runtime arena should be used for its allocation.
This commit is contained in:
parent
f44e41db38
commit
e1876e7f78
@ -235,3 +235,16 @@ t1 CREATE TABLE `t1` (
|
|||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||||
drop procedure sp;
|
drop procedure sp;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
|
||||||
|
# This test case was added by reviewer's request.
|
||||||
|
#
|
||||||
|
PREPARE stmt FROM 'CREATE TABLE t1 (a INT)';
|
||||||
|
EXECUTE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
ERROR 42S01: Table 't1' already exists
|
||||||
|
# Clean up
|
||||||
|
DROP TABLE t1;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
@ -189,3 +189,18 @@ call sp;
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
drop procedure sp;
|
drop procedure sp;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
|
||||||
|
--echo # This test case was added by reviewer's request.
|
||||||
|
--echo #
|
||||||
|
PREPARE stmt FROM 'CREATE TABLE t1 (a INT)';
|
||||||
|
EXECUTE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
EXECUTE stmt;
|
||||||
|
--error ER_TABLE_EXISTS_ERROR
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
--echo # Clean up
|
||||||
|
DROP TABLE t1;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
@ -5861,7 +5861,8 @@ static bool make_unique_constraint_name(THD *thd, LEX_CSTRING *name,
|
|||||||
if (!check) // Found unique name
|
if (!check) // Found unique name
|
||||||
{
|
{
|
||||||
name->length= (size_t) (real_end - buff);
|
name->length= (size_t) (real_end - buff);
|
||||||
name->str= strmake_root(thd->stmt_arena->mem_root, buff, name->length);
|
name->str= thd->strmake(buff, name->length);
|
||||||
|
|
||||||
return (name->str == NULL);
|
return (name->str == NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user