Solved

Problem in table unlocking

Posted on 2011-09-03
2
371 Views
Last Modified: 2012-05-12
Some times while dml operation is done on a table, during that process that table is implicitly locked. But it is not implicitly unlocking. This is not happening to all the tables in the module, but only to a specific table. We are working on Mysql 5.1 server and the table type is InnoDB. The table is locked till you explicitly unlock it. I am not getting solution to it.

Any one please let me know why this is happening and what is the solution.
0
Comment
Question by:darien_software
2 Comments
 
LVL 21

Accepted Solution

by:
oleggold earned 500 total points
ID: 36480176
from
http://forums.mysql.com/read.php?97,151989,151989
"The correct way to use LOCK TABLES with transactional tables, such as InnoDB tables, is to set AUTOCOMMIT = 0 and not to call UNLOCK TABLES until you commit the transaction explicitly. When you call LOCK TABLES, InnoDB internally takes its own table lock, and MySQL takes its own table lock. InnoDB releases its table lock at the next commit, but for MySQL to release its table lock, you have to call UNLOCK TABLES. You should not have AUTOCOMMIT = 1, because then InnoDB releases its table lock immediately after the call of LOCK TABLES, and deadlocks can very easily happen."
0
 

Author Comment

by:darien_software
ID: 36500551
Thanks oleggold.
I want a little more clarification from you. I have gone through the link you have provided. I am unable to understand the statement 'InnoDB releases the lock at the next commit'. What is next commit ?
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
when to use sequences in mysql 4 39
Very Large data in MYSQL 7 94
converting integer data type to time data type in sql 4 48
Error in sql query statment. 21 50
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question