Commit 822fb797 authored by Varun Gupta's avatar Varun Gupta

MDEV-11162 Assertion `num_records == m_idx_array.size()' failed in...

MDEV-11162 Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint)

When JOIN::destroy() is called for a JOIN object that has
   - join->tmp_join != NULL
   - also has join->table[0]->sort

then the latter was not cleaned up.
This could cause a memory leak and/or asserts in the subsequent queries.

Fixed by adding a cleanup call.
parent c32d3e16
......@@ -123,4 +123,11 @@ id xtext optionen
2 number 22,25
1 select Kabel mit Stecker 5-polig,Kabel ohne Stecker
DROP TABLE t1, t2;
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
SELECT ( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i );
( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i )
NULL
SELECT i FROM t1 order by i LIMIT 1;
i
DROP TABLE t1;
# End of tests
......@@ -125,4 +125,14 @@ ORDER BY id DESC;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-11162: Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint)
--echo #
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
SELECT ( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i );
SELECT i FROM t1 order by i LIMIT 1;
DROP TABLE t1;
--echo # End of tests
......@@ -3144,6 +3144,7 @@ JOIN::destroy()
*/
tmp_table_param.cleanup();
tmp_join->tmp_table_param.copy_field= 0;
cleanup(1);
DBUG_RETURN(tmp_join->destroy());
}
cond_equal= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment