[PATCH 1 of 2] issue1847 Remove limit and break on empty ids

Wald Commits scm-commit at wald.intevation.org
Thu Sep 3 17:49:07 CEST 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1441295116 -7200
# Node ID e9abf747f6cea0bd0814fc83f5f6a8ca4745d120
# Parent  9497f58484a0c85d5e98c36f7d0602ed7fe3a68d
issue1847 Remove limit and break on empty ids

diff -r 9497f58484a0 -r e9abf747f6ce artifact-database/src/main/java/org/dive4elements/artifactdatabase/DatabaseCleaner.java
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/DatabaseCleaner.java	Thu Sep 03 17:00:30 2015 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/DatabaseCleaner.java	Thu Sep 03 17:45:16 2015 +0200
@@ -296,10 +296,6 @@
                     fetchIds = conn.prepareStatement(
                         SQL_OUTDATED.replace("$LOCKED_IDS$", questionMarks));
 
-                    // some dbms like derby do not support LIMIT
-                    // in SQL statements.
-                    fetchIds.setMaxRows(MAX_ROWS);
-
                     // Fetch ids of outdated collections
                     stmnt = conn.prepareStatement(
                         SQL_OUTDATED_COLLECTIONS.replace(
@@ -378,7 +374,7 @@
                         }
 
                         if (ids.isEmpty()) {
-                            continue;
+                            break;
                         }
 
                         for (int i = ids.size()-1; i >= 0; --i) {
diff -r 9497f58484a0 -r e9abf747f6ce artifact-database/src/main/resources/sql/org-h2-driver.properties
--- a/artifact-database/src/main/resources/sql/org-h2-driver.properties	Thu Sep 03 17:00:30 2015 +0200
+++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties	Thu Sep 03 17:45:16 2015 +0200
@@ -13,8 +13,7 @@
 
 artifacts.outdated=SELECT id, factory, data, gid FROM artifacts WHERE ttl IS NOT NULL \
     AND DATEDIFF('MILLISECOND', last_access, CURRENT_TIMESTAMP) > ttl \
-    AND id NOT IN ($LOCKED_IDS$) \
-    LIMIT 50
+    AND id NOT IN ($LOCKED_IDS$)
 
 artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \
     AND (ttl IS NULL \
diff -r 9497f58484a0 -r e9abf747f6ce artifact-database/src/main/resources/sql/org-postgresql-driver.properties
--- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Thu Sep 03 17:00:30 2015 +0200
+++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Thu Sep 03 17:45:16 2015 +0200
@@ -13,8 +13,7 @@
 
 artifacts.outdated=SELECT id, factory, data, gid FROM artifacts WHERE ttl IS NOT NULL \
     AND CURRENT_TIMESTAMP - last_access > (ttl || ' milliseconds')::interval \
-    AND id NOT IN ($LOCKED_IDS$) \
-    LIMIT 50
+    AND id NOT IN ($LOCKED_IDS$)
 
 artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \
     AND (ttl IS NULL \


More information about the Dive4Elements-commits mailing list