aboutsummaryrefslogtreecommitdiffstats
path: root/feature-distributed-locking/src/main/feature/db/pooling
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-06-29 10:54:00 -0400
committerJim Hahn <jrh3@att.com>2018-06-29 12:25:04 -0400
commit1ed1beaaa4466fb55d7dba3e029b583b835b8aaf (patch)
tree0e5e1c3ff6cd5ca78ab76b491d21676c0b8ff111 /feature-distributed-locking/src/main/feature/db/pooling
parentee2313141a40222a83d6bf39a15c3f9d4c3a239e (diff)
Use DB time instead of jvm time
Modified distributed locking code to use the DB time (i.e., "now()") when determining expiration times of locks. This will eliminate concerns that may arise from different timestamps on different JVMs. As part of the change, the expirationTime column was changed from BIGINT to TIMESTAMP. Rename 1810 sql scripts to 1811, to match release date. Change-Id: Ibfb15742f447133b001e4340027657ac202864a6 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-distributed-locking/src/main/feature/db/pooling')
-rw-r--r--feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql19
-rw-r--r--feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql23
2 files changed, 42 insertions, 0 deletions
diff --git a/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql b/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql
new file mode 100644
index 00000000..33f6154d
--- /dev/null
+++ b/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql
@@ -0,0 +1,19 @@
+# ============LICENSE_START=======================================================
+# feature-distributed-locking
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+
+ALTER TABLE pooling.locks modify if exists expirationTime bigint(20);
diff --git a/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql b/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql
new file mode 100644
index 00000000..7862da9f
--- /dev/null
+++ b/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql
@@ -0,0 +1,23 @@
+# ============LICENSE_START=======================================================
+# feature-distributed-locking
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+
+ set foreign_key_checks=0;
+
+ ALTER TABLE pooling.locks modify if exists expirationTime timestamp default 0;
+
+ set foreign_key_checks=1;