From 21a1e1eed307b29066877cd1345b7083d9a58e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 29 Apr 2024 16:59:56 +0200 Subject: [PATCH 1/3] Hotfix feat: new function to kill connections --- db/routines/util/procedures/connection_kill.sql | 11 +++++++++++ db/routines/vn/procedures/collection_assign.sql | 7 ++----- db/routines/vn/procedures/collection_new.sql | 8 +++----- db/versions/11021-bronzeErica/00-firstScript.sql | 4 ++++ 4 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 db/routines/util/procedures/connection_kill.sql create mode 100644 db/versions/11021-bronzeErica/00-firstScript.sql diff --git a/db/routines/util/procedures/connection_kill.sql b/db/routines/util/procedures/connection_kill.sql new file mode 100644 index 000000000..c321a5117 --- /dev/null +++ b/db/routines/util/procedures/connection_kill.sql @@ -0,0 +1,11 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`(vConnectionId BIGINT) +BEGIN +/** + * Kill a connection + * + * @param vConnectionId + */ + KILL vConnectionId; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index 1c3ef06ab..e976367cd 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -30,10 +30,7 @@ BEGIN -- Si hay colecciones sin terminar, sale del proceso CALL collection_get(vUserFk); - SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, - pc.collectionAssignLockname - INTO vHasTooMuchCollections, - vLockName + SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections FROM productionConfig pc LEFT JOIN tCollection ON TRUE; @@ -49,7 +46,7 @@ BEGIN WHERE workerFk = vUserFk; SET vLockName = CONCAT_WS('/', - vLockName, + 'collection_assign', vWarehouseFk, vItemPackingTypeFk ); diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql index f207eb2b0..f3767ddf3 100644 --- a/db/routines/vn/procedures/collection_new.sql +++ b/db/routines/vn/procedures/collection_new.sql @@ -63,8 +63,7 @@ BEGIN o.numberOfWagons, o.trainFk, o.linesLimit, - o.volumeLimit, - pc.collectionNewLockname + o.volumeLimit INTO vMaxTickets, vHasUniqueCollectionTime, vWorkerCode, @@ -74,15 +73,14 @@ BEGIN vWagons, vTrainFk, vLinesLimit, - vVolumeLimit, - vLockName + vVolumeLimit FROM productionConfig pc JOIN worker w ON w.id = vUserFk JOIN state st ON st.`code` = 'ON_PREPARATION' JOIN operator o ON o.workerFk = vUserFk; SET vLockName = CONCAT_WS('/', - vLockName, + 'collection_new', vWarehouseFk, vItemPackingTypeFk ); diff --git a/db/versions/11021-bronzeErica/00-firstScript.sql b/db/versions/11021-bronzeErica/00-firstScript.sql new file mode 100644 index 000000000..f08667f8e --- /dev/null +++ b/db/versions/11021-bronzeErica/00-firstScript.sql @@ -0,0 +1,4 @@ + + ALTER TABLE vn.productionConfig + DROP COLUMN IF EXISTS collectionNewLockname, + DROP COLUMN IF EXISTS collectionAssignLockname; \ No newline at end of file From e55658e6b3301674ecd23bdc9561604f4380e714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 29 Apr 2024 17:02:47 +0200 Subject: [PATCH 2/3] Hotfix feat: new function to kill connections --- db/routines/util/procedures/connection_kill.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/util/procedures/connection_kill.sql b/db/routines/util/procedures/connection_kill.sql index c321a5117..b38509d1b 100644 --- a/db/routines/util/procedures/connection_kill.sql +++ b/db/routines/util/procedures/connection_kill.sql @@ -1,5 +1,7 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`(vConnectionId BIGINT) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`( + vConnectionId BIGINT +) BEGIN /** * Kill a connection From e934b47e9831c88b35eb07339bc179cc8947526e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 29 Apr 2024 17:09:51 +0200 Subject: [PATCH 3/3] Hotfix feat: new function to kill connections --- db/versions/11021-bronzeErica/00-firstScript.sql | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/db/versions/11021-bronzeErica/00-firstScript.sql b/db/versions/11021-bronzeErica/00-firstScript.sql index f08667f8e..6f6b68d49 100644 --- a/db/versions/11021-bronzeErica/00-firstScript.sql +++ b/db/versions/11021-bronzeErica/00-firstScript.sql @@ -1,4 +1,13 @@ ALTER TABLE vn.productionConfig DROP COLUMN IF EXISTS collectionNewLockname, - DROP COLUMN IF EXISTS collectionAssignLockname; \ No newline at end of file + DROP COLUMN IF EXISTS collectionAssignLockname; + + DELIMITER $$ + CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`() + BEGIN + + END$$ + DELIMITER ; + + GRANT EXECUTE ON PROCEDURE util.connection_kill TO 'developer'; \ No newline at end of file