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.
This commit is contained in:
Rucha Deodhar 2022-04-11 19:11:59 +05:30
parent b2ecb622a6
commit 3327bb6098
3 changed files with 32 additions and 1 deletions

View file

@ -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;

View file

@ -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 #

View file

@ -5129,7 +5129,8 @@ end:
*/
DBUG_ASSERT(thd->open_tables == NULL);
thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp);
thd->clear_error();
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,