Skip to content

Commit 3327bb6

Browse files
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.
1 parent b2ecb62 commit 3327bb6

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,17 @@ SELECT global.tmp_disk_table_size;
142142
ERROR 42S02: Unknown table 'global' in field list
143143
SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
144144
ERROR 42S22: Unknown column 'tmp_disk_table_size' in 'field list'
145+
#
146+
# Beginning of 10.4 test
147+
#
148+
# Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
149+
# failed on SELECT after setting tmp_disk_table_size.
150+
#
151+
SET @@tmp_disk_table_size=16384;
152+
CREATE VIEW v AS SELECT 'a';
153+
SELECT table_name FROM INFORMATION_SCHEMA.views;
154+
ERROR HY000: The table '(temporary)' is full
155+
DROP VIEW v;
156+
# End of 10.4 test
145157
SET @@global.tmp_disk_table_size = @start_global_value;
146158
SET @@session.tmp_disk_table_size = @start_session_value;

mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,22 @@ SELECT global.tmp_disk_table_size;
193193
--Error ER_BAD_FIELD_ERROR
194194
SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
195195

196+
--echo #
197+
--echo # Beginning of 10.4 test
198+
--echo #
199+
--echo # Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
200+
--echo # failed on SELECT after setting tmp_disk_table_size.
201+
--echo #
202+
203+
SET @@tmp_disk_table_size=16384;
204+
CREATE VIEW v AS SELECT 'a';
205+
206+
--error ER_RECORD_FILE_FULL
207+
SELECT table_name FROM INFORMATION_SCHEMA.views;
208+
209+
DROP VIEW v;
210+
211+
--echo # End of 10.4 test
196212

197213
####################################
198214
# Restore initial value #

sql/sql_show.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5129,7 +5129,8 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
51295129
*/
51305130
DBUG_ASSERT(thd->open_tables == NULL);
51315131
thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp);
5132-
thd->clear_error();
5132+
if (!thd->is_fatal_error)
5133+
thd->clear_error();
51335134
return res;
51345135
}
51355136

@@ -5345,6 +5346,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
53455346
error= 0;
53465347
goto err;
53475348
}
5349+
if (thd->is_fatal_error)
5350+
goto err;
53485351

53495352
DEBUG_SYNC(thd, "before_open_in_get_all_tables");
53505353
if (fill_schema_table_by_open(thd, &tmp_mem_root, FALSE,

0 commit comments

Comments
 (0)