Skip to content

Commit

Permalink
srm: make out-of-date historic data deletion more robust
Browse files Browse the repository at this point in the history
Motivation:

The SRM periodically (every 10 minutes, by default) deletes out-of-date
historic data (older than 10 days by default) using a scheduled task.
If this task throws any exception (e.g., any problem issuing the DELETE
SQL query) then subsequent invocations are suppressed.

Modification:

Catch any RuntimeException and log it appropriately.

Result:

Problems evicting out-of-date historic data are logged and the process
is robust against temporary database problems.

Target: master
Request: 2.16
Request: 2.15
Request: 2.14
Request: 2.13
Ticket: http://rt.dcache.org/Ticket/Display.html?id=9033
Patch: https://rb.dcache.org/r/9666/
  • Loading branch information
paulmillar committed Aug 22, 2016
1 parent d28e1dd commit d01040a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,13 @@ public void run()
long lifetime =
TimeUnit.DAYS.toMillis(configuration.getKeepRequestHistoryPeriod());
long timestamp = System.currentTimeMillis() - lifetime;
jdbcTemplate.update("DELETE FROM " + getTableName() + " WHERE CREATIONTIME + LIFETIME < ?", timestamp);
try {
jdbcTemplate.update("DELETE FROM " + getTableName() + " WHERE CREATIONTIME + LIFETIME < ?", timestamp);
} catch (DataAccessException e) {
logger.warn("Failed to remove out-of-date historic data from {}: {}", getTableName(), e.toString());
} catch (RuntimeException e) {
logger.error("Bug detected", e);
}
}

protected PreparedStatement getPreparedStatement(
Expand Down

0 comments on commit d01040a

Please sign in to comment.