Skip to content

Commit

Permalink
chimera: update DB schema to support CREATION_TIME
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kofemann committed Nov 19, 2013
1 parent ee05697 commit 9bc76df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Expand Up @@ -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(?,?,?,?,?,?,?,?,?,?,?,?)";

/**
*
Expand Down Expand Up @@ -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();

Expand Down
Expand Up @@ -5,6 +5,32 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

<changeSet author="tigran" id="14">
<addColumn tableName="t_inodes">
<column name="icrtime" type="DATETIME" remarks="file/directory creation timestamp"/>
</addColumn>
</changeSet>

<changeSet author="tigran" id="15">
<sql stripComments="true">
UPDATE t_inodes SET icrtime = (
SELECT
CASE
WHEN ictime &lt;= imtime and ictime &lt;= iatime THEN ictime
WHEN imtime &lt;= ictime and imtime &lt;= iatime THEN imtime
ELSE iatime
END AS icrtime
FROM t_inodes AS p WHERE p.ipnfsid = t_inodes.ipnfsid
)
</sql>
</changeSet>

<changeSet author="tigran" id="16">
<addNotNullConstraint columnDataType="DATETIME"
columnName="icrtime"
tableName="t_inodes"/>
</changeSet>

<changeSet author="litvinse" id="17" dbms="postgresql">
<createProcedure>
--- RFC 2396 : http://www.ietf.org/rfc/rfc2396.txt
Expand Down Expand Up @@ -94,4 +120,5 @@
LANGUAGE 'plpgsql';
</createProcedure>
</changeSet>

</databaseChangeLog>

0 comments on commit 9bc76df

Please sign in to comment.