From 1ed1beaaa4466fb55d7dba3e029b583b835b8aaf Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 29 Jun 2018 10:54:00 -0400 Subject: 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 --- .../sql/1811-distributedlocking.downgrade.sql | 19 ++++++++++++++++++ .../sql/1811-distributedlocking.upgrade.sql | 23 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql create mode 100644 feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql (limited to 'feature-distributed-locking/src/main/feature/db') 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; -- cgit 1.2.3-korg