Mercurial > dive4elements > framework
changeset 543:e9abf747f6ce
issue1847 Remove limit and break on empty ids
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 03 Sep 2015 17:45:16 +0200 |
parents | 9497f58484a0 |
children | 0e3ecf7cd461 |
files | artifact-database/src/main/java/org/dive4elements/artifactdatabase/DatabaseCleaner.java artifact-database/src/main/resources/sql/org-h2-driver.properties artifact-database/src/main/resources/sql/org-postgresql-driver.properties |
diffstat | 3 files changed, 3 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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) {
--- 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 \
--- 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 \