summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeijun Huang <huangweijun1001@gmail.com>2023-03-02 21:21:46 +0100
committerDaniel Black <daniel@mariadb.org>2023-03-09 08:51:00 +1100
commit231c0eb7a68570da6b5b3741b2f1431c2f43c475 (patch)
tree24d0d99dc468746f4bf9d131d95119e4f382513f
parent1e58b8afc086da755cf9209ed17fc36351da5563 (diff)
downloadmariadb-git-231c0eb7a68570da6b5b3741b2f1431c2f43c475.tar.gz
MDEV-23000: Ensure we get a warning from THD::drop_temporary_table() in case of disk errors
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/temporary_tables.cc13
2 files changed, 8 insertions, 7 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 8c51312ce2a..a5a5f3df44d 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -5050,7 +5050,7 @@ private:
bool use_temporary_table(TABLE *table, TABLE **out_table);
void close_temporary_table(TABLE *table);
bool log_events_and_free_tmp_shares();
- void free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table);
+ bool free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table);
void free_temporary_table(TABLE *table);
bool lock_temporary_tables();
void unlock_temporary_tables();
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 8236d157b73..8555aa1a7f5 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -670,7 +670,7 @@ bool THD::drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table)
temporary_tables->remove(share);
/* Free the TABLE_SHARE and/or delete the files. */
- free_tmp_table_share(share, delete_table);
+ result= free_tmp_table_share(share, delete_table);
end:
if (locked)
@@ -1455,20 +1455,21 @@ bool THD::log_events_and_free_tmp_shares()
@param share [IN] TABLE_SHARE to free
@param delete_table [IN] Whether to delete the table files?
- @return void
+ @return false Success
+ true Error
*/
-void THD::free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table)
+bool THD::free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table)
{
+ bool error= false;
DBUG_ENTER("THD::free_tmp_table_share");
if (delete_table)
{
- rm_temporary_table(share->db_type(), share->path.str);
+ error= rm_temporary_table(share->db_type(), share->path.str);
}
free_table_share(share);
my_free(share);
-
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}