summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-06-19 10:49:00 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-06-19 10:49:00 +0300
commit02979daab48d871e8c43a227b8f4462128439f17 (patch)
tree21dba14f0073df2328677ed0a90a3596f043bdeb /sql/sql_admin.cc
parentefbfcc8b73d9fd8bafd86ab387e0c1edd39e208b (diff)
parent192aa295b4bc877d0fed24154c57304c3f789179 (diff)
downloadmariadb-git-02979daab48d871e8c43a227b8f4462128439f17.tar.gz
Merge 10.3 into 10.4
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 d004bcd974a..5dcb7ffac72 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)