Commit 01a0d739 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-24975 Server consumes extra 4G memory upon querying INFORMATION_SCHEMA.OPTIIMIZER_TRACE

if a query used no fields from an I_S table, we were creating a temp
table with one, first, field (as a table cannot have zero fields),
with its length truncated to 1.

Now - force also this dummy field to be a normal field, not a BLOB
parent f24038b8
...@@ -8591,4 +8591,13 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) ...@@ -8591,4 +8591,13 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
] ]
DROP TABLE t1; DROP TABLE t1;
set optimizer_trace='enabled=off'; set optimizer_trace='enabled=off';
#
# MDEV-24975 Server consumes extra 4G memory upon querying INFORMATION_SCHEMA.OPTIIMIZER_TRACE
#
set max_session_mem_used=1024*1024*1024;
select count(*) from information_schema.optimizer_trace;
select * from information_schema.optimizer_trace;
set max_session_mem_used=default;
#
# End of 10.4 tests # End of 10.4 tests
#
...@@ -623,4 +623,17 @@ SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from IN ...@@ -623,4 +623,17 @@ SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from IN
DROP TABLE t1; DROP TABLE t1;
set optimizer_trace='enabled=off'; set optimizer_trace='enabled=off';
--echo #
--echo # MDEV-24975 Server consumes extra 4G memory upon querying INFORMATION_SCHEMA.OPTIIMIZER_TRACE
--echo #
set max_session_mem_used=1024*1024*1024;
--disable_result_log
select count(*) from information_schema.optimizer_trace;
select * from information_schema.optimizer_trace;
--enable_result_log
set max_session_mem_used=default;
--echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo #
...@@ -8767,6 +8767,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) ...@@ -8767,6 +8767,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables)
{ {
/* all fields were optimized away. Force a non-0-length row */ /* all fields were optimized away. Force a non-0-length row */
table->s->reclength= to_recinfo->length= 1; table->s->reclength= to_recinfo->length= 1;
to_recinfo->type= FIELD_NORMAL;
to_recinfo++; to_recinfo++;
} }
p->recinfo= to_recinfo; p->recinfo= to_recinfo;
......
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