From 9bc76dfaf8c7d662aa0e902616a084ccceed5e54 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Fri, 13 Sep 2013 11:07:09 +0200 Subject: [PATCH] chimera: update DB schema to support CREATION_TIME update jdbcfs to populate creation time A new field 'icrtime' is introduced to keep track of file creation time. The initial value for ald files will be oldest from mtime, ctime and atime. Acked-by: Paul Millar Target: master Require-book: yes Require-notes: yes --- .../java/org/dcache/chimera/FsSqlDriver.java | 3 ++- .../chimera/changelog/changeset-2.8.xml | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/chimera/src/main/java/org/dcache/chimera/FsSqlDriver.java b/modules/chimera/src/main/java/org/dcache/chimera/FsSqlDriver.java index 0a4e71c48d0..1f57530d834 100644 --- a/modules/chimera/src/main/java/org/dcache/chimera/FsSqlDriver.java +++ b/modules/chimera/src/main/java/org/dcache/chimera/FsSqlDriver.java @@ -611,7 +611,7 @@ String inode2path(Connection dbConnection, FsInode inode, FsInode startFrom, boo return path; } - private static final String sqlCreateInode = "INSERT INTO t_inodes VALUES(?,?,?,?,?,?,?,?,?,?,?)"; + private static final String sqlCreateInode = "INSERT INTO t_inodes VALUES(?,?,?,?,?,?,?,?,?,?,?,?)"; /** * @@ -650,6 +650,7 @@ public void createInode(Connection dbConnection, FsInode inode, int type, int ui stCreateInode.setTimestamp(9, now); stCreateInode.setTimestamp(10, now); stCreateInode.setTimestamp(11, now); + stCreateInode.setTimestamp(12, now); stCreateInode.executeUpdate(); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/changelog/changeset-2.8.xml b/modules/chimera/src/main/resources/org/dcache/chimera/changelog/changeset-2.8.xml index d19a20fdb7e..41213f1c399 100644 --- a/modules/chimera/src/main/resources/org/dcache/chimera/changelog/changeset-2.8.xml +++ b/modules/chimera/src/main/resources/org/dcache/chimera/changelog/changeset-2.8.xml @@ -5,6 +5,32 @@ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> + + + + + + + + + UPDATE t_inodes SET icrtime = ( + SELECT + CASE + WHEN ictime <= imtime and ictime <= iatime THEN ictime + WHEN imtime <= ictime and imtime <= iatime THEN imtime + ELSE iatime + END AS icrtime + FROM t_inodes AS p WHERE p.ipnfsid = t_inodes.ipnfsid + ) + + + + + + + --- RFC 2396 : http://www.ietf.org/rfc/rfc2396.txt @@ -94,4 +120,5 @@ LANGUAGE 'plpgsql'; +