Details
-
Type:
Bug
-
Status: Closed
-
Resolution: Not a Bug
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
I have a problem with LOCK/FLUSH.
I have a script in python to make backup for some tables. This script works follow :
1.- USE name_of_db;
2.- LOCK TABLES table_name READ;
3.- FLUSH TABLES table_name ;
4.- And I copy files for this table (index and data) in a backup folder.
5.- UNLOCK TABLES;
Whith MariaDB 5.2 works fine but in MariaDB 5.5 don't works. After FLUSH TABLES table_name I have this error :
ERROR 1099 (HY000): Table 'table_name' was locked with a READ lock and can't be updated
Check this example :
~$ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 235
Server version: 5.5.23-MariaDB-mariadb1~squeeze mariadb.org binary distribution
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> USE test ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [test]> LOCK TABLES testblob READ ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> FLUSH TABLES testblob ;
ERROR 1099 (HY000): Table 'testblob' was locked with a READ lock and can't be updated
MariaDB [test]> UNLOCK TABLES ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> Bye
~$ dpkg -l | grep mariadb-server
ii mariadb-server-5.5 5.5.23-mariadb1~squeeze MariaDB database server binaries
ii mariadb-server-core-5.5 5.5.23-mariadb1~squeeze MariaDB database core server files
~$ uname -a
Linux servername1 2.6.32-5-686-bigmem #1 SMP Mon Mar 26 06:12:49 UTC 2012 i686 GNU/Linux
~$lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.4 (squeeze)
Release: 6.0.4
Codename: squeeze
How can I do to make my backup?
Thank you
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Problem LOCK/FLUSH : Table was locked with a READ lock and can't be updated
Hi,
It is not MariaDB-specific. This is a change in behavior introduced in MySQL 5.5.3, see the manual http://dev.mysql.com/doc/refman/5.5/en/flush.html:
"As of MySQL 5.5.3, FLUSH TABLES is not permitted when there is an active LOCK TABLES ... READ. To flush and lock tables, use FLUSH TABLES tbl_list WITH READ LOCK instead."