Commit 3327bb60 authored by Rucha Deodhar's avatar Rucha Deodhar

MDEV-22266: Diagnostics_area::sql_errno() const: Assertion

`m_status == DA_ERROR' failed on SELECT after setting tmp_disk_table_size.

Analysis: Mismatch in number of warnings between "194 warnings" vs
"64 rows in set" is because of max_error_count variable which has default
value of 64.
About the corrupted tables, the error that occurs because of insufficient
tmp_disk_table_size variable is not reported correctly and we continue to
execute the statement. But because the previous error (about table being
full)is not reported correctly, this error moves up the stack and is
wrongly reported as parsing error later on while parsing frm file of one
of the information schema table. This parsing error gives corrupted table
error.
As for the innodb error, it occurs even when tmp_disk_table_size is not
insufficient is default but the internal error handler takes care of it
and the error doesn't show. But when tmp_disk_table_size is insufficient,
the fatal error which wasn't reported correctly moves up the stack so
internal error handler is not called. So it shows errors.
Fix: Report the error correctly.
parent b2ecb622
......@@ -142,5 +142,17 @@ SELECT global.tmp_disk_table_size;
ERROR 42S02: Unknown table 'global' in field list
SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
ERROR 42S22: Unknown column 'tmp_disk_table_size' in 'field list'
#
# Beginning of 10.4 test
#
# Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
# failed on SELECT after setting tmp_disk_table_size.
#
SET @@tmp_disk_table_size=16384;
CREATE VIEW v AS SELECT 'a';
SELECT table_name FROM INFORMATION_SCHEMA.views;
ERROR HY000: The table '(temporary)' is full
DROP VIEW v;
# End of 10.4 test
SET @@global.tmp_disk_table_size = @start_global_value;
SET @@session.tmp_disk_table_size = @start_session_value;
......@@ -193,6 +193,22 @@ SELECT global.tmp_disk_table_size;
--Error ER_BAD_FIELD_ERROR
SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
--echo #
--echo # Beginning of 10.4 test
--echo #
--echo # Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
--echo # failed on SELECT after setting tmp_disk_table_size.
--echo #
SET @@tmp_disk_table_size=16384;
CREATE VIEW v AS SELECT 'a';
--error ER_RECORD_FILE_FULL
SELECT table_name FROM INFORMATION_SCHEMA.views;
DROP VIEW v;
--echo # End of 10.4 test
####################################
# Restore initial value #
......
......@@ -5129,6 +5129,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
*/
DBUG_ASSERT(thd->open_tables == NULL);
thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp);
if (!thd->is_fatal_error)
thd->clear_error();
return res;
}
......@@ -5345,6 +5346,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
error= 0;
goto err;
}
if (thd->is_fatal_error)
goto err;
DEBUG_SYNC(thd, "before_open_in_get_all_tables");
if (fill_schema_table_by_open(thd, &tmp_mem_root, 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