1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries

JOIN_CACHE has a light-weight initialization mode that's targeted at
EXPLAINs. In that mode, JOIN_CACHE objects are not able to execute.

Light-weight mode was used whenever the statement was an EXPLAIN. However
the EXPLAIN can execute subqueries, provided they enumerate less than
@@expensive_subquery_limit rows.

Make sure we use light-weight initialization mode only when the select is
more expensive @@expensive_subquery_limit.

Also add an assert into JOIN_CACHE::put_record() which prevents its use
if it was initialized for EXPLAIN only.
This commit is contained in:
Sergei Petrunia
2024-03-20 13:09:12 +03:00
parent a618ff2b1c
commit 8cc36fb743
5 changed files with 68 additions and 1 deletions

View File

@ -1589,6 +1589,7 @@ bool JOIN_CACHE::put_record()
{
bool is_full;
uchar *link= 0;
DBUG_ASSERT(!for_explain_only);
if (prev_cache)
link= prev_cache->get_curr_rec_link();
write_record_data(link, &is_full);