[Commits] 9db9c340773: MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF , window functions and views
revision-id: 9db9c3407734b8e322a6d11c973ee216870e8197 (mariadb-10.2.19-55-g9db9c340773) parent(s): 59e0d3f0f61968f89f3272c68723744fde5263cc author: Varun Gupta committer: Varun Gupta timestamp: 2018-12-15 21:35:20 +0530 message: MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF , window functions and views Adding destructor for Group_bound_tracker to free Cached_item_str. The Cached_item for window functions are allocated on THD:mem_root but the Cached_item_str has value of type string which is allocated on the heap, so we need to call free() for it. --- mysql-test/r/win.result | 17 +++++++++++++++++ mysql-test/t/win.test | 12 ++++++++++++ sql/item_windowfunc.h | 4 ++++ 3 files changed, 33 insertions(+) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index c83cc6cd170..99480214a69 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3476,3 +3476,20 @@ ifnull(max(n1) over (partition by n1),'aaa') 4 drop table t1; drop view v1; +# +# MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF, +# window functions and views +# +create table t1 (id int, n1 int); +insert into t1 values (1,1),(2,1),(3,2),(4,4); +explain +select max(n1) over (order by 'abc') from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary +select max(n1) over (order by 'abc') from t1; +max(n1) over (order by 'abc') +4 +4 +4 +4 +drop table t1; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 73bb8c46e3f..5110d584554 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2230,3 +2230,15 @@ select * from v1; select * from v1; drop table t1; drop view v1; + +--echo # +--echo # MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF, +--echo # window functions and views +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1),(2,1),(3,2),(4,4); +explain +select max(n1) over (partition by 'abc') from t1; +select max(n1) over (partition by 'abc') from t1; +drop table t1; diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 21270733051..465fa6ea991 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -70,6 +70,10 @@ class Group_bound_tracker } return 0; } + ~Group_bound_tracker() + { + group_fields.delete_elements(); + } private: List<Cached_item> group_fields;
participants (1)
-
Varun