[MDEV-2554] LP:987165 - Problem LOCK/FLUSH : Table was locked with a READ lock and can't be updated Created: 2012-04-23  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: del (Inactive) Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug987165.xml    

 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



 Comments   
Comment by Elena Stepanova [ 2012-04-23 ]

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."

Comment by Rasmus Johansson (Inactive) [ 2012-04-23 ]

Launchpad bug id: 987165

Comment by del (Inactive) [ 2012-04-23 ]

Re: Problem LOCK/FLUSH : Table was locked with a READ lock and can't be updated
OK. Thank you.

Generated at Thu Feb 08 06:42:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.