diff options
| author | Monty <monty@mariadb.org> | 2018-10-31 22:52:29 +0200 |
|---|---|---|
| committer | Monty <monty@mariadb.org> | 2018-12-09 22:12:26 +0200 |
| commit | 7fb9d64989ad8bb86ee47ded88dc5e2493aca4b8 (patch) | |
| tree | a965ed7e10fc1bf4f0c1b052d3a653a6ec33ae47 /mysql-test/suite/handler | |
| parent | 7bb3a5220e9960c5b3c0fd44d656d26d45b3cdef (diff) | |
| download | mariadb-git-7fb9d64989ad8bb86ee47ded88dc5e2493aca4b8.tar.gz | |
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>
Diffstat (limited to 'mysql-test/suite/handler')
| -rw-r--r-- | mysql-test/suite/handler/interface.result | 6 | ||||
| -rw-r--r-- | mysql-test/suite/handler/interface.test | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result index c4a169be185..8c39b15b6c9 100644 --- a/mysql-test/suite/handler/interface.result +++ b/mysql-test/suite/handler/interface.result @@ -175,6 +175,7 @@ c1 connect flush,localhost,root,,; connection flush; flush tables; +flush table t1; connect waiter,localhost,root,,; connection waiter; connection default; @@ -258,10 +259,11 @@ a b flush tables; handler t1 read a next; a b -0 a +2 c +flush tables t1; handler t1 read a next; a b -1 b +0 a flush tables with read lock; handler t1 read a next; a b diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test index 15853dfdbf5..0ecdbf9c5cf 100644 --- a/mysql-test/suite/handler/interface.test +++ b/mysql-test/suite/handler/interface.test @@ -179,12 +179,13 @@ handler t1 open; handler t1 read first; connect (flush,localhost,root,,); connection flush; -send flush tables; +flush tables; +send flush table t1; connect (waiter,localhost,root,,); connection waiter; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush"; + where state = "Waiting for table metadata lock"; --source include/wait_condition.inc connection default; handler t2 open; @@ -282,6 +283,7 @@ handler t1 read a first; handler t1 read a next; flush tables; handler t1 read a next; +flush tables t1; handler t1 read a next; flush tables with read lock; handler t1 read a next; |
