MDEV-15888 Implement FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK for views.

Enable the FLUSH TABLES for views. It works now.
This commit is contained in:
Alexey Botchkov 2021-02-09 00:59:55 +04:00
commit b118f92be6
6 changed files with 120 additions and 16 deletions

View file

@ -592,7 +592,8 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
for (TABLE_LIST *table_list= all_tables; table_list;
table_list= table_list->next_global)
{
if (!(table_list->table->file->ha_table_flags() & HA_CAN_EXPORT))
if (!(table_list->is_view() ||
table_list->table->file->ha_table_flags() & HA_CAN_EXPORT))
{
my_error(ER_ILLEGAL_HA, MYF(0),table_list->table->file->table_type(),
table_list->db.str, table_list->table_name.str);
@ -606,7 +607,8 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
for (auto table_list= all_tables; table_list;
table_list= table_list->next_global)
{
if (table_list->table->file->extra(HA_EXTRA_FLUSH))
if (!table_list->is_view() &&
table_list->table->file->extra(HA_EXTRA_FLUSH))
goto error_reset_bits;
}
}