changeset 243:33b9cc23ac9b

Granularity of ttls should be milliseconds and not microseconds. artifacts/trunk@1678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 13 Apr 2011 15:19:59 +0000
parents b35d32e507b6
children 3d14fe6e05f7
files ChangeLog artifact-database/src/main/resources/sql/org-h2-driver.properties artifact-database/src/main/resources/sql/org-postgresql-driver.properties
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 13 11:26:53 2011 +0000
+++ b/ChangeLog	Wed Apr 13 15:19:59 2011 +0000
@@ -1,3 +1,10 @@
+2011-04-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* artifact-database/src/main/resources/sql/org-postgresql-driver.properties:
+	  Internal granularity should be milliseconds and not microseconds.
+
+	* artifact-database/src/main/resources/sql/org-h2-driver.properties:
+	  Forget last commit.
 2011-04-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	Fix for flys/issue9
--- a/artifact-database/src/main/resources/sql/org-h2-driver.properties	Wed Apr 13 11:26:53 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties	Wed Apr 13 15:19:59 2011 +0000
@@ -15,10 +15,10 @@
     AND id NOT IN ($LOCKED_IDS$) \
     LIMIT 50
 
-artifacts.select.gid=SELECT id, factory, data FROM artifacts WHERE gid = ?::uuid \
+artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \
     AND (ttl IS NULL \
     OR  (DATEDIFF('MILLISECOND', last_access, CURRENT_TIMESTAMP) <= ttl)  \
-    OR  id IN (SELECT artifact_id FROM collection_items)) \
+    OR  id IN (SELECT artifact_id FROM collection_items))
 
 artifacts.get.id=SELECT id FROM artifacts WHERE gid = ?
 
--- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Wed Apr 13 11:26:53 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Wed Apr 13 15:19:59 2011 +0000
@@ -10,14 +10,14 @@
 artifacts.touch=UPDATE artifacts SET last_access = CURRENT_TIMESTAMP WHERE id = ?
 
 artifacts.outdated=SELECT id, factory, data FROM artifacts WHERE ttl IS NOT NULL \
-    AND CURRENT_TIMESTAMP - last_access > (ttl || ' microseconds')::interval \
+    AND CURRENT_TIMESTAMP - last_access > (ttl || ' milliseconds')::interval \
     AND id NOT IN (SELECT DISTINCT artifact_id FROM collection_items) \
     AND id NOT IN ($LOCKED_IDS$) \
     LIMIT 50
 
 artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \
     AND (ttl IS NULL \
-    OR  (CURRENT_TIMESTAMP - last_access <= (ttl || ' microseconds')::interval) \
+    OR  (CURRENT_TIMESTAMP - last_access <= (ttl || ' milliseconds')::interval) \
     OR  id IN (SELECT artifact_id FROM collection_items))
 
 artifacts.get.id=SELECT id FROM artifacts WHERE gid = ?::uuid
@@ -75,7 +75,7 @@
 
 collection.item.outdate.artifact= \
     UPDATE artifacts \
-    SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \
+    SET last_access = CURRENT_TIMESTAMP - '2 milliseconds'::interval, ttl = 1 \
     WHERE id = ? AND \
     NOT EXSITS \
     (SELECT id FROM collection_items WHERE collection_id <> ? AND artifact_id = ?)
@@ -94,7 +94,7 @@
         INNER JOIN collection_items ci ON c.id = ci.collection_id \
         INNER JOIN artifacts        a  ON ci.artifact_id = a.id \
         WHERE c.ttl IS NOT NULL \
-            AND CURRENT_TIMESTAMP - c.last_access > (c.ttl || ' microseconds')::interval \
+            AND CURRENT_TIMESTAMP - c.last_access > (c.ttl || ' milliseconds')::interval \
             AND a.id NOT IN ($LOCKED_IDS$)
 
 collections.touch.by.gid =\
@@ -145,14 +145,14 @@
     artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?)
 
 outdate.artifacts.collection=UPDATE artifacts \
-    SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \
+    SET last_access = CURRENT_TIMESTAMP - '2 milliseconds'::interval, ttl = 1 \
     WHERE id IN \
     (SELECT artifact_id FROM collection_items \
         WHERE collection_id = ? AND \
         artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?))
 
 outdate.artifacts.user=UPDATE artifacts \
-    SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \
+    SET last_access = CURRENT_TIMESTAMP - '2 milliseconds'::interval, ttl = 1 \
     WHERE id IN \
     (SELECT artifact_id FROM collection_items WHERE \
         collection_id IN (SELECT id FROM collections WHERE owner_id = ?) \

http://dive4elements.wald.intevation.org