mariadb/mysql-test/suite/maria/system_tables.test
Monty 7fb9d64989 Changed FLUSH TABLES to not change share version
Part of MDEV-5336 Implement LOCK FOR BACKUP

Originally both table metadata lock and global read lock protection
were acquired before getting TABLE from table cache. This will be
reordered in a future commit with MDL_BACKUP_XXX locks so that we
first take table metadata lock, then get TABLE from table cache, then
acquire analogue of global read lock.

This patch both simplifies FLUSH TABLES code, makes FLUSH TABLES to
lock less and also enables FLUSH TABLES code to be used with backup
locks.

The usage of FLUSH TABLES changes slightly:
- FLUSH TABLES without any arguments will now only close not used tables
  and tables locked by the FLUSH TABLES connection.  All not used table
  shares will be closed.
  Tables locked by the FLUSH TABLES connection will be reopened and
  re-locked after all others has stoped using the table (as before).
  If there was no locked tables, then FLUSH TABLES is instant and will
  not cause any waits.
  FLUSH TABLES will not wait for any in use table.
- FLUSH TABLES with a table list, will ensure that the tables are closed
  before statement returns. The code is now only using MDL locks and not
  table share versions, which simplices the code greatly. One visible
  change is that the server will wait for the end of the transaction that
  are using the tables. Before FLUSH TABLES only waited for the statements
  to end.

Signed-off-by: Monty <monty@mariadb.org>
2018-12-09 22:12:26 +02:00

27 lines
485 B
Text

#
# Test related to Aria system tables
#
#
# MDEV-16986 Unitialized mutex, SIGSEGV and assorted assertion failures in
# Aria code
#
CREATE TABLE t1 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE;
--connect (con1,localhost,root,,test)
SET lock_wait_timeout= 2;
FLUSH TABLES;
--send FLUSH TABLES t1
--connection default
--error ER_SP_DOES_NOT_EXIST
CALL non_existing_sp;
--connection con1
--error ER_LOCK_WAIT_TIMEOUT
--reap
# Cleanup
--disconnect con1
--connection default
DROP TABLE t1;