From a4d3eec1e1bd7066323f06318d38b702c63754a0 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 26 Jul 2024 14:05:22 +0200 Subject: [PATCH] fix: refs #7580 Parking deadlock --- db/routines/vn/procedures/saleGroup_setParking.sql | 9 ++------- db/routines/vn/procedures/setParking.sql | 10 ---------- db/routines/vn/procedures/shelving_setParking.sql | 6 +++--- db/routines/vn/procedures/ticket_setParking.sql | 5 ----- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/db/routines/vn/procedures/saleGroup_setParking.sql b/db/routines/vn/procedures/saleGroup_setParking.sql index 551ca6386..fffe5e154 100644 --- a/db/routines/vn/procedures/saleGroup_setParking.sql +++ b/db/routines/vn/procedures/saleGroup_setParking.sql @@ -10,15 +10,10 @@ BEGIN * @param vSaleGroupFk id de la preparación previa * @param vParkingFk id del parking */ - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - RESIGNAL; - END; - UPDATE saleGroup sg SET sg.parkingFk = vParkingFk - WHERE sg.id = vSaleGroupFk - AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK; + WHERE sg.id = vSaleGroupFk + AND sg.created >= util.VN_CURDATE() - INTERVAL 1 WEEK; CALL ticket_setNextState(ticket_get(vSaleGroupFk)); END$$ diff --git a/db/routines/vn/procedures/setParking.sql b/db/routines/vn/procedures/setParking.sql index 1aa4f920a..b3edf350d 100644 --- a/db/routines/vn/procedures/setParking.sql +++ b/db/routines/vn/procedures/setParking.sql @@ -13,12 +13,6 @@ BEGIN DECLARE vParkingFk INT; DECLARE vLastWeek DATE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - SET vParkingCode = REPLACE(vParkingCode, ' ', ''); SELECT id INTO vParkingFk @@ -29,8 +23,6 @@ BEGIN CALL util.throw('parkingNotExist'); END IF; - START TRANSACTION; - SET vLastWeek = util.VN_CURDATE() - INTERVAL 1 WEEK; -- Comprobamos si es una prep. previa, ticket, colección o shelving @@ -45,7 +37,5 @@ BEGIN ELSE CALL util.throw('paramNotExist'); END IF; - - COMMIT; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/shelving_setParking.sql b/db/routines/vn/procedures/shelving_setParking.sql index 0ff07ef5d..3e8717197 100644 --- a/db/routines/vn/procedures/shelving_setParking.sql +++ b/db/routines/vn/procedures/shelving_setParking.sql @@ -1,20 +1,20 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`shelving_setParking`(IN `vShelvingCode` VARCHAR(8), IN `vParkingFk` INT) -proc: BEGIN +BEGIN /** * Aparca una matrícula en un parking * * @param vShelvingCode code de la matrícula * @param vParkingFk id del parking */ - INSERT INTO vn.shelvingLog (originFk, userFk, action , description,changedModel,changedModelId) + INSERT INTO shelvingLog (originFk, userFk, action , description,changedModel,changedModelId) SELECT s.id, account.myUser_getId(), 'update', CONCAT("Cambio parking ",vShelvingCode," de ", p.code," a ", pNew.code),'Shelving',s.id FROM parking p JOIN shelving s ON s.parkingFk = p.id JOIN parking pNew ON pNew.id = vParkingFk WHERE s.code = vShelvingCode COLLATE utf8_unicode_ci; - UPDATE vn.shelving + UPDATE shelving SET parkingFk = vParkingFk, parked = util.VN_NOW(), isPrinted = TRUE diff --git a/db/routines/vn/procedures/ticket_setParking.sql b/db/routines/vn/procedures/ticket_setParking.sql index 7935e0d60..bd2a5370a 100644 --- a/db/routines/vn/procedures/ticket_setParking.sql +++ b/db/routines/vn/procedures/ticket_setParking.sql @@ -21,11 +21,6 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - RESIGNAL; - END; - INSERT INTO vn.ticketParking(ticketFk, parkingFk) SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk FROM ticket t