I have a simple stored procedure and for testing purposes I have commented out COMMIT statement.
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
START TRANSACTION;
SELECT * FROM Kimmel_tree FOR UPDATE;
INSERT INTO Kimmel_tree (name, guid) VALUES('abc', 'abcd');
#COMMIT;
END
I wanted to check what happens if internet cable is unplugged while transaction is not yet commited. The result is that transaction is rolled back but the lock on whole table is not released. As a result I can't do anything to the table. Sometimes it takes up to twenty minutes for the lock to get released just for no reason. How can I make sure that the used resources are unlocked on ROLLBACK?