summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-08-16 10:51:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-08-16 10:51:20 +0300
commitc221bcdce7714a74b89a02de941e8d8df2994ce3 (patch)
tree87a4e2d595ea3cc1465f212f26a9b9030655aa0c /sql/sql_table.cc
parent3bbf008096fc997556459442bc2503c504248345 (diff)
parent395e1dcd176bbf0fcdb5d156bc58604590245a26 (diff)
downloadmariadb-git-c221bcdce7714a74b89a02de941e8d8df2994ce3.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc60
1 files changed, 27 insertions, 33 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f94676730b7..f3e4d35c0f5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2392,35 +2392,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
/* remove .frm file and engine files */
path_length= build_table_filename(path, sizeof(path) - 1, db.str, alias.str,
reg_ext, 0);
-
- /*
- This handles the case where a "DROP" was executed and a regular
- table "may be" dropped as drop_temporary is FALSE and error is
- TRUE. If the error was FALSE a temporary table was dropped and
- regardless of the status of drop_temporary a "DROP TEMPORARY"
- must be used.
- */
- if (!dont_log_query)
- {
- /*
- Note that unless if_exists is TRUE or a temporary table was deleted,
- there is no means to know if the statement should be written to the
- binary log. See further information on this variable in what follows.
- */
- non_tmp_table_deleted= (if_exists ? TRUE : non_tmp_table_deleted);
- /*
- Don't write the database name if it is the current one (or if
- thd->db is NULL).
- */
- if (thd->db.str == NULL || cmp(&db, &thd->db) != 0)
- {
- append_identifier(thd, &built_query, &db);
- built_query.append(".");
- }
-
- append_identifier(thd, &built_query, &table->table_name);
- built_query.append(",");
- }
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table");
error= 0;
@@ -2500,9 +2471,16 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
// Remove extension for delete
*(end= path + path_length - reg_ext_length)= '\0';
- error= ha_delete_table(thd, table_type, path, &db, &table->table_name,
- !dont_log_query);
- if (!error)
+ if ((error= ha_delete_table(thd, table_type, path, &db, &table->table_name,
+ !dont_log_query)))
+ {
+ if (thd->is_killed())
+ {
+ error= -1;
+ goto err;
+ }
+ }
+ else
{
/* Delete the table definition file */
strmov(end,reg_ext);
@@ -2546,7 +2524,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
if (error)
{
if (wrong_tables.length())
- wrong_tables.append(',');
+ wrong_tables.append(',');
wrong_tables.append(&db);
wrong_tables.append('.');
wrong_tables.append(&table->table_name);
@@ -2559,6 +2537,22 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
mysql_audit_drop_table(thd, table);
}
+ if (!dont_log_query && !drop_temporary)
+ {
+ non_tmp_table_deleted= (if_exists ? TRUE : non_tmp_table_deleted);
+ /*
+ Don't write the database name if it is the current one (or if
+ thd->db is NULL).
+ */
+ if (thd->db.str == NULL || cmp(&db, &thd->db) != 0)
+ {
+ append_identifier(thd, &built_query, &db);
+ built_query.append(".");
+ }
+
+ append_identifier(thd, &built_query, &table->table_name);
+ built_query.append(",");
+ }
DBUG_PRINT("table", ("table: %p s: %p", table->table,
table->table ? table->table->s : NULL));
}