From 20e1b6517b1c64a82cb52be8a2a2882c86b1318b Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sun, 24 Feb 2019 10:42:15 -0500 Subject: Prevent race conditions on same distributionId. - Code to include optimistic lock to prevent race conditions on same distributionId. Change-Id: Ibe110b32f2472d991a4a3e03e3d15d5e4deefd65 Issue-ID: SO-1566 Signed-off-by: Benjamin, Max (mb388a) --- .../mso-api-handler-infra/src/test/resources/data.sql | 8 ++++---- .../mso-api-handler-infra/src/test/resources/schema.sql | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/resources') diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql index 712cb98c07..f99f89653f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql @@ -31,10 +31,10 @@ INSERT INTO requestdb.activate_operational_env_per_distributionid_status(DISTRIB ('TEST_distributionId_2', 'DISTRIBUTION_COMPLETE_OK', NULL, '2018-02-02 18:44:27', '2018-02-02 18:45:06', '1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74'); -INSERT INTO requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, CREATE_TIME, MODIFY_TIME) VALUES -('1533c4bd-a3e3-493f-a16d-28c20614415e', '', '2017-11-30 15:48:09', '2017-11-30 15:48:09'), -('55429711-809b-4a3b-9ee5-5120d46d9de0', '', '2017-11-30 16:35:36', '2017-11-30 16:35:36'), -('67f0b2d1-9013-4b2b-9914-bbe2288284fb', '', '2017-11-30 15:54:39', '2017-11-30 15:54:39'); +INSERT INTO requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, LOCK_VERSION, CREATE_TIME, MODIFY_TIME) VALUES +('1533c4bd-a3e3-493f-a16d-28c20614415e', '', 0, '2017-11-30 15:48:09', '2017-11-30 15:48:09'), +('55429711-809b-4a3b-9ee5-5120d46d9de0', '', 0, '2017-11-30 16:35:36', '2017-11-30 16:35:36'), +('67f0b2d1-9013-4b2b-9914-bbe2288284fb', '', 0, '2017-11-30 15:54:39', '2017-11-30 15:54:39'); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index 95db1c2b7a..5873e147bc 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -946,6 +946,7 @@ CREATE TABLE `site_status` ( CREATE TABLE `watchdog_distributionid_status` ( `DISTRIBUTION_ID` varchar(45) NOT NULL, `DISTRIBUTION_ID_STATUS` varchar(45) DEFAULT NULL, + `LOCK_VERSION` int NOT NULL, `CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`DISTRIBUTION_ID`) -- cgit 1.2.3-korg