>>>>> "Konstantin" == Konstantin Osipov <kostja@stripped> writes:
Konstantin> I'm personally convinced that FLUSH TABLES, FLUSH TABLES <list>,
Konstantin> FLUSH TABLES WITH READ LOCK should wait for all started *write*
Konstantin> (only write) transactions against the involved tables to complete.
To answer this one, we should consider what FLUSH TABLES is used for.
It's main (only?) purposes are
- To allow easy file system level backups of the databases
- To prepare a database for a snapshot
- (Optional) Flush things to disk, so that a restart is faster.
In no case above do we need to wait for *write* transactions to
finish. This is especially true when doing system level snapshots.
The gut feeling is thus that we should not wait for transactions to
finish for the above commands.
About the mutex; We only take a mutex (at least in 5.1) if there is a
global read lock active, in which case it doesn't really matter if we
take one or two mutex. In normal operations there is no mutex, so
this is no argument for changing the behavior for FLUSH TABLES.
Have you already tried MariaDB? http://askmonty.org/wiki/MariaDB