Commit 46751d4b authored by Monty's avatar Monty Committed by Sergei Golubchik

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

parent 7d1467e9
...@@ -199,4 +199,18 @@ set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage; ...@@ -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; 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; SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
ERROR HY000: Local temporary space limit reached 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 # End of 11.5 tests
...@@ -259,4 +259,20 @@ SET max_tmp_session_space_usage= 64*1024; ...@@ -259,4 +259,20 @@ SET max_tmp_session_space_usage= 64*1024;
--error 200 --error 200
SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS; 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 --echo # End of 11.5 tests
...@@ -4972,7 +4972,10 @@ int JOIN::exec_inner() ...@@ -4972,7 +4972,10 @@ int JOIN::exec_inner()
if ((this->select_lex->options & OPTION_SCHEMA_TABLE) && if ((this->select_lex->options & OPTION_SCHEMA_TABLE) &&
get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC)) get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC))
DBUG_RETURN(0); {
error= thd->is_error();
DBUG_RETURN(error);
}
if (select_options & SELECT_DESCRIBE) if (select_options & SELECT_DESCRIBE)
{ {
...@@ -345,11 +345,32 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -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) int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
DBUG_ENTER("fill_all_plugins"); DBUG_ENTER("fill_all_plugins");
TABLE *table= tables->table; TABLE *table= tables->table;
LOOKUP_FIELD_VALUES lookup; LOOKUP_FIELD_VALUES lookup;
plugin_show_error_handler err_handler;
const char *wstr, *wend;
if (get_lookup_field_values(thd, cond, true, tables, &lookup)) if (get_lookup_field_values(thd, cond, true, tables, &lookup))
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -364,10 +385,16 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -364,10 +385,16 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->push_internal_handler(&err_handler);
if (!lookup.db_value.str) if (!lookup.db_value.str)
plugin_dl_foreach(thd, 0, show_plugins, table); {
if (plugin_dl_foreach(thd, 0, show_plugins, table) && thd->is_error())
goto end;
}
const char *wstr= lookup.db_value.str, *wend= wstr + lookup.db_value.length; wstr= lookup.db_value.str;
wend= wstr + lookup.db_value.length;
for (size_t i=0; i < dirp->number_of_files; i++) for (size_t i=0; i < dirp->number_of_files; i++)
{ {
FILEINFO *file= dirp->dir_entry+i; FILEINFO *file= dirp->dir_entry+i;
...@@ -394,12 +421,14 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -394,12 +421,14 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
} }
} }
plugin_dl_foreach(thd, &dl, show_plugins, table); if (plugin_dl_foreach(thd, &dl, show_plugins, table) && thd->is_error())
thd->clear_error(); break;
} }
end:
thd->pop_internal_handler();
my_dirend(dirp); 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, ...@@ -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_WRONG_OBJECT
&& thd->get_stmt_da()->sql_errno() != ER_NOT_SEQUENCE; && thd->get_stmt_da()->sql_errno() != ER_NOT_SEQUENCE;
if (!run) if (!run)
{
thd->clear_error(); thd->clear_error();
result= false;
}
else if (!ext_error_handling) else if (!ext_error_handling)
{
convert_error_to_warning(thd); convert_error_to_warning(thd);
result= false; result= false;
}
} }
} }
......
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