← Back to team overview

maria-discuss team mailing list archive

Re: [EXTERNAL] Re: Copying database files


Hi, Reindl!

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

Chief Architect MariaDB
and security@xxxxxxxxxxx

Follow ups