1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-34060 Unexpected behavior upon reading I_S.ALL_PLUGINS under limited tmp space.

This commit is contained in:
Monty
2024-05-03 10:27:35 +03:00
committed by Sergei Golubchik
parent 7d1467e9e9
commit 46751d4b81
4 changed files with 75 additions and 8 deletions

View File

@ -199,4 +199,18 @@ set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage;
SET max_tmp_session_space_usage= 64*1024;
SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
ERROR HY000: Local temporary space limit reached
#
# MDEV-34060 Unexpected behavior upon reading I_S.ALL_PLUGINS under
# limited tmp space
#
connect c1, localhost, root,,;
set @@binlog_format=row;
CREATE OR REPLACE TABLE t1 (a DATETIME) ENGINE=MyISAM;
INSERT INTO t1 SELECT NOW() FROM seq_1_to_6000;
SET max_tmp_session_space_usage = 64*1024;
SELECT * FROM information_schema.ALL_PLUGINS LIMIT 2;
ERROR HY000: Local temporary space limit reached
drop table t1;
connection default;
disconnect c1;
# End of 11.5 tests

View File

@ -259,4 +259,20 @@ SET max_tmp_session_space_usage= 64*1024;
--error 200
SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
--echo #
--echo # MDEV-34060 Unexpected behavior upon reading I_S.ALL_PLUGINS under
--echo # limited tmp space
--echo #
connect(c1, localhost, root,,);
set @@binlog_format=row;
CREATE OR REPLACE TABLE t1 (a DATETIME) ENGINE=MyISAM;
INSERT INTO t1 SELECT NOW() FROM seq_1_to_6000;
SET max_tmp_session_space_usage = 64*1024;
--error 200
SELECT * FROM information_schema.ALL_PLUGINS LIMIT 2;
drop table t1;
connection default;
disconnect c1;
--echo # End of 11.5 tests

View File

@ -4972,7 +4972,10 @@ int JOIN::exec_inner()
if ((this->select_lex->options & OPTION_SCHEMA_TABLE) &&
get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC))
DBUG_RETURN(0);
{
error= thd->is_error();
DBUG_RETURN(error);
}
if (select_options & SELECT_DESCRIBE)
{

View File

@ -345,11 +345,32 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
}
/* Ignore common errors from plugin load */
class plugin_show_error_handler : public Internal_error_handler
{
public:
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
Sql_condition::enum_warning_level *level,
const char* msg,
Sql_condition ** cond_hdl)
{
if (sql_errno == ER_CANT_FIND_DL_ENTRY)
return true;
return false;
}
};
int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
{
DBUG_ENTER("fill_all_plugins");
TABLE *table= tables->table;
LOOKUP_FIELD_VALUES lookup;
plugin_show_error_handler err_handler;
const char *wstr, *wend;
if (get_lookup_field_values(thd, cond, true, tables, &lookup))
DBUG_RETURN(0);
@ -364,10 +385,16 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(1);
}
if (!lookup.db_value.str)
plugin_dl_foreach(thd, 0, show_plugins, table);
thd->push_internal_handler(&err_handler);
const char *wstr= lookup.db_value.str, *wend= wstr + lookup.db_value.length;
if (!lookup.db_value.str)
{
if (plugin_dl_foreach(thd, 0, show_plugins, table) && thd->is_error())
goto end;
}
wstr= lookup.db_value.str;
wend= wstr + lookup.db_value.length;
for (size_t i=0; i < dirp->number_of_files; i++)
{
FILEINFO *file= dirp->dir_entry+i;
@ -394,12 +421,14 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
}
}
plugin_dl_foreach(thd, &dl, show_plugins, table);
thd->clear_error();
if (plugin_dl_foreach(thd, &dl, show_plugins, table) && thd->is_error())
break;
}
end:
thd->pop_internal_handler();
my_dirend(dirp);
DBUG_RETURN(0);
DBUG_RETURN(thd->is_error());
}
@ -4810,10 +4839,15 @@ fill_schema_table_by_open(THD *thd, MEM_ROOT *mem_root,
&& thd->get_stmt_da()->sql_errno() != ER_WRONG_OBJECT
&& thd->get_stmt_da()->sql_errno() != ER_NOT_SEQUENCE;
if (!run)
{
thd->clear_error();
result= false;
}
else if (!ext_error_handling)
{
convert_error_to_warning(thd);
result= false;
result= false;
}
}
}