From 6b336a983cab6206f081be88fd446d4e5a3700fd Mon Sep 17 00:00:00 2001 From: Glenn Renfro Date: Fri, 20 Dec 2019 09:18:59 -0500 Subject: [PATCH] Resolves Task Lock issue with Oracle DB In short the Oracle CHAR type is blank padded to the end of the field. So we were not getting an exact match on queries when looking for the LOCK_KEY or CLIENT_ID --- .../cloud/task/migration/2.2.x/migration-oracle.sql | 2 ++ .../org/springframework/cloud/task/schema-oracle10g.sql | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/migration/2.2.x/migration-oracle.sql diff --git a/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/migration/2.2.x/migration-oracle.sql b/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/migration/2.2.x/migration-oracle.sql new file mode 100644 index 00000000..8c06abaf --- /dev/null +++ b/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/migration/2.2.x/migration-oracle.sql @@ -0,0 +1,2 @@ +alter table TASK_LOCK MODIFY LOCK_KEY VARCHAR2(36); +alter table TASK_LOCK MODIFY CLIENT_ID VARCHAR2(36); diff --git a/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/schema-oracle10g.sql b/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/schema-oracle10g.sql index 4b4e95b0..ea8c4185 100644 --- a/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/schema-oracle10g.sql +++ b/spring-cloud-task-core/src/main/resources/org/springframework/cloud/task/schema-oracle10g.sql @@ -29,9 +29,9 @@ CREATE TABLE TASK_TASK_BATCH ( CREATE SEQUENCE TASK_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NOCACHE NOCYCLE; CREATE TABLE TASK_LOCK ( - LOCK_KEY CHAR(36) NOT NULL, + LOCK_KEY VARCHAR2(36) NOT NULL, REGION VARCHAR2(100) NOT NULL, - CLIENT_ID CHAR(36), + CLIENT_ID VARCHAR2(36), CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) );