Am 13.08.2018 um 14:33 schrieb Sergei Golubchik:
On Aug 13, Reindl Harald wrote:
Am 13.08.2018 um 12:22 schrieb Ling, Andy:
"The advantage of FLUSH TABLES table_name FOR EXPORT is that the table is read locked until UNLOCK TABLES is executed" is not really true because that's only valid for the running connection
Surely not. If you've locked a table for read only nothing should be able to write to it from any connection otherwise what's the point of a multi-threaded server? Tests suggest otherwise.
surely YES
https://blogs.vmware.com/vsphere/2014/12/mysql-backup-with-vdp.html "Another item to be aware of with this statement is that the read lock is released as soon as the session that made the call ends. When the pre-freeze-script finishes, the session is closed" - try it out
and how do you make a script that locks the table and continues without closing the session to mysqld?
It's possible. In one of my personal projects I've used something like
echo "flush tables with read lock;\n\! mysqlhotcopy ..." | mysql
please read again what i quoted from the article! it is *not* possible except for some very limited usecases * vmware calls a shell script which should lock tables * vmware does fs-freeze, the script is completly finished * vmware takes a snaphot of the guest * from the moment the script with "flush tables with read lock;" has finsihed the lock is gone