summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2022-04-11 19:11:59 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2022-04-12 01:22:51 +0530
commit3327bb6098c42e82a72bfc5f8080b2e6cf79a025 (patch)
tree8698036f721513df6b2064836be8160f5b53a8b8
parentb2ecb622a6d11df4f670041fbd7f48fe4077808a (diff)
downloadmariadb-git-3327bb6098c42e82a72bfc5f8080b2e6cf79a025.tar.gz
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.
-rw-r--r--mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test16
-rw-r--r--sql/sql_show.cc5
3 files changed, 32 insertions, 1 deletions
diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result
index 0acf8428100..81453d72274 100644
--- a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result
@@ -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;
diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test
index 123f522a3a4..099be354486 100644
--- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test
@@ -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 #
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 00a06a6e404..76970676c3b 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -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,