summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-06-19 08:56:10 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-06-19 08:56:10 +0300
commit192aa295b4bc877d0fed24154c57304c3f789179 (patch)
tree893239effa9f3c9a7d00b324de9b4e41c63bdb4d /sql/sql_admin.cc
parent03f3ba2dcb07a672f9c1d87489b9ec88af62a96f (diff)
parent8acbf9c1f961aa1008ef509e059e1a09943f5ed3 (diff)
downloadmariadb-git-192aa295b4bc877d0fed24154c57304c3f789179.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 157d5d9f050..1c1ab82e570 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -700,19 +700,23 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
MDL_SHARED_NO_READ_WRITE lock (MDL_SHARED_WRITE cannot be upgraded)
by *not* having HA_CONCURRENT_OPTIMIZE table_flag.
*/
- if (lock_type == TL_WRITE && !table->table->s->tmp_table &&
- table->mdl_request.type > MDL_SHARED_WRITE)
+ if (lock_type == TL_WRITE && table->mdl_request.type > MDL_SHARED_WRITE)
{
- if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED))
- goto err;
- DEBUG_SYNC(thd, "after_admin_flush");
- /* Flush entries in the query cache involving this table. */
- query_cache_invalidate3(thd, table->table, 0);
- /*
- XXX: hack: switch off open_for_modify to skip the
- flush that is made later in the execution flow.
- */
- open_for_modify= 0;
+ if (table->table->s->tmp_table)
+ thd->close_unused_temporary_table_instances(tables);
+ else
+ {
+ if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED))
+ goto err;
+ DEBUG_SYNC(thd, "after_admin_flush");
+ /* Flush entries in the query cache involving this table. */
+ query_cache_invalidate3(thd, table->table, 0);
+ /*
+ XXX: hack: switch off open_for_modify to skip the
+ flush that is made later in the execution flow.
+ */
+ open_for_modify= 0;
+ }
}
if (table->table->s->crashed && operator_func == &handler::ha_check)