From ee056972d38eae331e00ae1b7f7e6c365a067748 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Fri, 13 Sep 2013 13:01:08 +0200 Subject: [PATCH] chimera: remove historic SQL code Acked-by: Dmitry Litvintsev Target: master Require-book: no Require-notes: no --- .../org/dcache/chimera/sql/add-timezone.sql | 45 --- .../dcache/chimera/sql/addACLtoChimeraDB.sql | 20 -- .../org/dcache/chimera/sql/cacheinfo-pgs.sql | 18 -- .../org/dcache/chimera/sql/cacheinfo.sql | 11 - .../dcache/chimera/sql/create-dCacheACL.sql | 18 -- .../org/dcache/chimera/sql/create-db2.sql | 275 ---------------- .../org/dcache/chimera/sql/create-hsqldb.sql | 246 -------------- .../org/dcache/chimera/sql/create-oracle.sql | 304 ------------------ .../dcache/chimera/sql/migrate-2-1.9.3.sql | 27 -- .../dcache/chimera/sql/pgsql-procedures.sql | 249 -------------- .../org/dcache/chimera/sql/pnfsid-mapping.sql | 6 - .../org/dcache/chimera/sql/top_dir.sql | 6 - .../chimera/sql/transaction-loggin-pg.sql | 129 -------- 13 files changed, 1354 deletions(-) delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/add-timezone.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/addACLtoChimeraDB.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo-pgs.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/create-dCacheACL.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/create-db2.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/create-hsqldb.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/create-oracle.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/migrate-2-1.9.3.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/pgsql-procedures.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/pnfsid-mapping.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/top_dir.sql delete mode 100644 modules/chimera/src/main/resources/org/dcache/chimera/sql/transaction-loggin-pg.sql diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/add-timezone.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/add-timezone.sql deleted file mode 100644 index 37b63399a82..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/add-timezone.sql +++ /dev/null @@ -1,45 +0,0 @@ --- --- fix timestamp field to support TIME ZONE --- -ALTER TABLE t_inodes ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_inodes ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_inodes ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_1 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_1 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_1 ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_2 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_2 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_2 ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_3 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_3 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_3 ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_4 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_4 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_4 ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_5 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_5 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_5 ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_6 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_6 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_6 ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_level_7 ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_level_7 ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_level_7 ALTER imtime TYPE timestamp with time zone; - - -ALTER TABLE t_tags_inodes ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_tags_inodes ALTER iatime TYPE timestamp with time zone; -ALTER TABLE t_tags_inodes ALTER imtime TYPE timestamp with time zone; - -ALTER TABLE t_locationinfo ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_locationinfo ALTER iatime TYPE timestamp with time zone; - -ALTER TABLE t_locationinfo_trash ALTER ictime TYPE timestamp with time zone; -ALTER TABLE t_locationinfo_trash ALTER iatime TYPE timestamp with time zone; diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/addACLtoChimeraDB.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/addACLtoChimeraDB.sql deleted file mode 100644 index 59edcf33c84..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/addACLtoChimeraDB.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- ACL table layout --- for postgreSQL --- - -CREATE TABLE t_acl ( - rs_id CHAR(36) NOT NULL, - rs_type int4 NOT NULL, - type smallint NOT NULL DEFAULT 0, - flags int4 NULL, - access_msk int4 NOT NULL DEFAULT 0, - who smallint NOT NULL, - who_id int4, - address_msk CHAR(32) NOT NULL DEFAULT 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', - ace_order int4 NOT NULL DEFAULT 0, - PRIMARY KEY (rs_id, ace_order), - FOREIGN KEY (rs_id) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE - ); - -CREATE INDEX i_t_acl_rs_id ON t_acl(rs_id); \ No newline at end of file diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo-pgs.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo-pgs.sql deleted file mode 100644 index 7df8e89dd14..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo-pgs.sql +++ /dev/null @@ -1,18 +0,0 @@ - - -DROP TABLE cacheinfo; -DROP INDEX pool_inx; -DROP INDEX pnfs_inx; - - - -CREATE TABLE cacheinfo ( - pnfsid CHAR(24) NOT NULL, - pool VARCHAR(255) NOT NULL, - ctime TIMESTAMP NOT NULL, - UNIQUE(pnfsid, pool) -); - -create index pool_inx on cacheinfo (pool); -create index pnfs_inx on cacheinfo (pnfsid); - diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo.sql deleted file mode 100644 index fac5fedca3a..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/cacheinfo.sql +++ /dev/null @@ -1,11 +0,0 @@ - -DROP TABLE IF EXISTS cacheinfo; - -CREATE TABLE cacheinfo ( - pnfsid CHAR(24) NOT NULL , - pool VARCHAR(255) NOT NULL, - ctime TIMESTAMP NOT NULL, - INDEX(pnfsid), - INDEX(pool), - UNIQUE(pnfsid,pool) -); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-dCacheACL.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-dCacheACL.sql deleted file mode 100644 index d3427e39874..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-dCacheACL.sql +++ /dev/null @@ -1,18 +0,0 @@ --- --- ACL table layout --- for postgreSQL --- - -CREATE TABLE t_acl ( - rs_id varchar(36) NOT NULL, - rs_type int4 NOT NULL, - type smallint NOT NULL DEFAULT 0, - flags int4 NULL, - access_msk int4 NOT NULL DEFAULT 0, - who smallint NOT NULL, - who_id int4, - address_msk varchar(32) NOT NULL DEFAULT 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', - ace_order int4 NOT NULL DEFAULT 0, - PRIMARY KEY (rs_id, ace_order) - ); - CREATE INDEX i_t_acl_rs_id ON t_acl(rs_id); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-db2.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-db2.sql deleted file mode 100644 index 38f71be8d62..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-db2.sql +++ /dev/null @@ -1,275 +0,0 @@ --- --- Chinera table layout --- for DB2 (9.1) --- --- $Id: create-db2.sql 296 2007-10-30 21:09:30Z tigran $ - --- --- Inodes --- - -CREATE TABLE t_inodes ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - itype INTEGER NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - iio INTEGER NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL -); - --- --- dirs --- - -CREATE TABLE t_dirs ( - iparent CHAR(36) NOT NULL, - iname VARCHAR(255) NOT NULL, - ipnfsid CHAR(36) NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - PRIMARY KEY (iparent,iname) -); - --- --- data --- - -CREATE TABLE t_inodes_data ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE -); - --- --- pnfs levels 1-7 --- - -CREATE TABLE t_level_1 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_2 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_3 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_4 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_5 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_6 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_7 ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ifiledata BLOB, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - - --- --- Name: t_tags_inodes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE t_tags_inodes ( - itagid CHAR(36) PRIMARY KEY NOT NULL, - imode INTEGER NOT NULL, - inlink INTEGER NOT NULL, - iuid INTEGER NOT NULL, - igid INTEGER NOT NULL, - isize BIGINT NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - imtime TIMESTAMP NOT NULL, - ivalue BLOB -); - --- --- Name: t_tags; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE t_tags ( - ipnfsid CHAR(36) NOT NULL, - itagname VARCHAR(255) NOT NULL, - itagid CHAR(36) NOT NULL, - isorign INTEGER NOT NULL, - PRIMARY KEY (ipnfsid, itagname), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - FOREIGN KEY (itagid) REFERENCES t_tags_inodes( itagid ) -); - --- --- populate Inodes --- - -INSERT INTO t_inodes VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', 16384, 493, 2, 0, 0, 512, 0, current_TIMESTAMP, current_TIMESTAMP, current_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('000000000000000000000000000000000000', 16384, 493, 6, 0, 0, 512, 0, current_TIMESTAMP, current_TIMESTAMP, current_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('A0D739870178504FF109C52075F44287F9DE', 16384, 493, 4, 0, 0, 512, 0, current_TIMESTAMP, current_TIMESTAMP, current_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 16384, 493, 6, 0, 0, 512, 1, current_TIMESTAMP, current_TIMESTAMP, current_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', 16384, 493, 2, 0, 0, 512, 1, current_TIMESTAMP, current_TIMESTAMP, current_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('80D1B8B90CED30430608C58002811B3285FC', 16384, 493, 2, 0, 0, 512, 1, current_TIMESTAMP, current_TIMESTAMP, current_TIMESTAMP ); - --- --- directory --- - -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', '.', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', 'admin','A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', '.', 'A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', 'usr', 'F674EC8B0CFF104AA109828000696CAD6CAC'); -INSERT INTO t_dirs VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', '.', 'F674EC8B0CFF104AA109828000696CAD6CAC'); -INSERT INTO t_dirs VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', 'etc', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', '.', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', '..', 'A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 'config','80D1B8B90CED30430608C58002811B3285FC'); -INSERT INTO t_dirs VALUES ('80D1B8B90CED30430608C58002811B3285FC', '.', '80D1B8B90CED30430608C58002811B3285FC'); -INSERT INTO t_dirs VALUES ('80D1B8B90CED30430608C58002811B3285FC', '..', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 'exports','E3BB936F04F6D047A70B75201EDBA32FA9F5'); -INSERT INTO t_dirs VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', '.', 'E3BB936F04F6D047A70B75201EDBA32FA9F5'); -INSERT INTO t_dirs VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', '..', '1B3BB44C05C9904DFB0928F06F2467395CD5'); - - --- --- For faster lookups --- - -CREATE INDEX i_dirs_iparent ON t_dirs(iparent); - --- --- For faster getparent --- - -CREATE INDEX i_dirs_ipnfsid ON t_dirs(ipnfsid); - - --- STORAGE INFO --- --- Generic storage information. Represents X:Y@Z + AL +RP --- ipnfsid : pnfsid of the inode --- ihsmName : Z-component of storageGroup --- istorageGroup : X-component of storageGroup --- istorageSubGroup : Y-component of storageGroup --- iaccessLatency : ONLINE / NEARLINE ( keep on disk / keep on disk, if there is a space) --- iretentionPolicy : CUSTODIAL / OUTPUT ( tape / disk ) - - -CREATE TABLE t_storageinfo ( - ipnfsid CHAR(36) PRIMARY KEY NOT NULL, - ihsmName VARCHAR(64) NOT NULL, - istorageGroup VARCHAR(64) NOT NULL, - istorageSubGroup VARCHAR(64) NOT NULL, - iaccessLatency INTEGER NOT NULL, - iretentionPolicy INTEGER NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - - --- LOCATION INFO --- --- Generic storage information --- ipnfsid : pnfsid of the inode --- itype : type of storage, e.g. tape, disk --- ilocation : type specific information like pool name for disk and HSM connetion for tape --- ipriority : in case of multiple locations of hint for performance or other needs --- ictime : location creation time --- iatime : last access time, probably performance killer, but nice to have for statistics --- istate : location status ONLINE/OFF-LINE - - -CREATE TABLE t_locationinfo ( - ipnfsid CHAR(36) NOT NULL, - itype INTEGER NOT NULL, - ilocation VARCHAR(512) NOT NULL, - ipriority INTEGER NOT NULL, - ictime TIMESTAMP NOT NULL, - iatime TIMESTAMP NOT NULL, - istate INTEGER NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - PRIMARY KEY (ipnfsid,itype,ilocation) -); - -CREATE INDEX i_locationinfo_ipnfsid ON t_locationinfo(ipnfsid); - diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-hsqldb.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-hsqldb.sql deleted file mode 100644 index 00c40471f5d..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-hsqldb.sql +++ /dev/null @@ -1,246 +0,0 @@ -CREATE TABLE t_inodes ( - ipnfsid character(36) PRIMARY KEY, - itype integer NOT NULL, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - iio integer NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL -); - -CREATE TABLE t_dirs ( - iparent character(36) NOT NULL, - iname character varying(255) NOT NULL, - ipnfsid character(36) NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - PRIMARY KEY (iparent,iname) -); - -CREATE TABLE t_inodes_data ( - ipnfsid character(36) PRIMARY KEY, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE -); - -CREATE TABLE t_inodes_checksum ( - ipnfsid character(36) PRIMARY KEY, - itype integer NOT NULL, - isum character varying(128) NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE -); - -CREATE TABLE t_level_1 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_2 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_3 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_4 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_5 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_6 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_7 ( - ipnfsid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ifiledata BINARY(1024), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_tags_inodes ( - itagid character(36) PRIMARY KEY, - imode integer NOT NULL, - inlink integer NOT NULL, - iuid integer NOT NULL, - igid integer NOT NULL, - isize bigint NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - imtime timestamp NOT NULL, - ivalue BINARY(1024) -); - -CREATE TABLE t_tags ( - ipnfsid character(36) NOT NULL, - itagname character varying(255) NOT NULL, - itagid character(36) NOT NULL, - isorign integer NOT NULL, - PRIMARY KEY (ipnfsid, itagname), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - FOREIGN KEY (itagid) REFERENCES t_tags_inodes( itagid ) -); - -INSERT INTO t_inodes VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', 16384, 493, 2, 0, 0, 512, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('000000000000000000000000000000000000', 16384, 493, 6, 0, 0, 512, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('A0D739870178504FF109C52075F44287F9DE', 16384, 493, 4, 0, 0, 512, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 16384, 493, 6, 0, 0, 512, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', 16384, 493, 2, 0, 0, 512, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ); -INSERT INTO t_inodes VALUES ('80D1B8B90CED30430608C58002811B3285FC', 16384, 493, 2, 0, 0, 512, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP ); - -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', '.', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', 'admin','A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', '.', 'A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', 'usr', 'F674EC8B0CFF104AA109828000696CAD6CAC'); -INSERT INTO t_dirs VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', '.', 'F674EC8B0CFF104AA109828000696CAD6CAC'); -INSERT INTO t_dirs VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', 'etc', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', '.', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', '..', 'A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 'config','80D1B8B90CED30430608C58002811B3285FC'); -INSERT INTO t_dirs VALUES ('80D1B8B90CED30430608C58002811B3285FC', '.', '80D1B8B90CED30430608C58002811B3285FC'); -INSERT INTO t_dirs VALUES ('80D1B8B90CED30430608C58002811B3285FC', '..', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 'exports','E3BB936F04F6D047A70B75201EDBA32FA9F5'); -INSERT INTO t_dirs VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', '.', 'E3BB936F04F6D047A70B75201EDBA32FA9F5'); -INSERT INTO t_dirs VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', '..', '1B3BB44C05C9904DFB0928F06F2467395CD5'); - -CREATE INDEX i_dirs_iparent ON t_dirs(iparent); - -CREATE INDEX i_dirs_ipnfsid ON t_dirs(ipnfsid); - -CREATE TABLE t_storageinfo ( - ipnfsid CHAR(36) PRIMARY KEY, - ihsmName VARCHAR(64) NOT NULL, - istorageGroup VARCHAR(64) NOT NULL, - istorageSubGroup VARCHAR(64) NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE -); - -CREATE TABLE t_access_latency ( - ipnfsid CHAR(36) PRIMARY KEY, - iaccessLatency INT NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE -); - - -CREATE TABLE t_retention_policy ( - ipnfsid CHAR(36) PRIMARY KEY, - iretentionPolicy INT NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) ON DELETE CASCADE -); - - -CREATE TABLE t_locationinfo ( - ipnfsid CHAR(36), - itype INT NOT NULL, - ilocation VARCHAR(1024) NOT NULL, - ipriority INT NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - istate INT NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - PRIMARY KEY (ipnfsid,itype,ilocation) -); - -CREATE TABLE t_locationinfo_trash ( - ipnfsid CHAR(36), - itype INT NOT NULL, - ilocation VARCHAR(1024) NOT NULL, - ipriority INT NOT NULL, - ictime timestamp NOT NULL, - iatime timestamp NOT NULL, - istate INT NOT NULL, - PRIMARY KEY (ipnfsid,itype,ilocation) -); - -CREATE INDEX i_locationinfo_ipnfsid ON t_locationinfo(ipnfsid); - -CREATE TABLE t_acl ( - rs_id CHAR(36) NOT NULL, - rs_type INT NOT NULL, - type INT DEFAULT 0 NOT NULL, - flags INT NOT NULL, - access_msk INT DEFAULT 0 NOT NULL, - who INT NOT NULL, - who_id INT, - address_msk CHAR(32) DEFAULT 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' NOT NULL, - ace_order INT DEFAULT 0 NOT NULL, - PRIMARY KEY (rs_id, ace_order) - ); - - CREATE INDEX i_t_acl_rs_id ON t_acl(rs_id); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-oracle.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-oracle.sql deleted file mode 100644 index ccfc4ac6a99..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/create-oracle.sql +++ /dev/null @@ -1,304 +0,0 @@ --- --- Chimera table layout --- for ORACLE (10g) --- --- $Id: create-oracle.sql 296 2007-10-30 21:09:30Z tigran $ - --- --- Inodes --- - -CREATE TABLE t_inodes ( - ipnfsid CHAR(36) PRIMARY KEY, - itype NUMBER NOT NULL, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - iio NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL -); - --- --- dirs --- - -CREATE TABLE t_dirs ( - iparent CHAR(36) NOT NULL, - iname VARCHAR(255) NOT NULL, - ipnfsid CHAR(36) NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - PRIMARY KEY (iparent,iname) -); - - --- --- data --- - -CREATE TABLE t_inodes_data ( - ipnfsid CHAR(36) PRIMARY KEY, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - - - --- --- Checksums --- -CREATE TABLE t_inodes_checksum ( - ipnfsid CHAR(36) PRIMARY KEY, - itype NUMBER NOT NULL, - isum VARCHAR(128) NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - --- --- pnfs levels 1-7 --- - -CREATE TABLE t_level_1 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_2 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_3 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_4 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_5 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_6 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - -CREATE TABLE t_level_7 ( - ipnfsid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ifiledata LONG RAW, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - - --- --- Name: t_tags_inodes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE t_tags_inodes ( - itagid CHAR(36) PRIMARY KEY, - imode NUMBER NOT NULL, - inlink NUMBER NOT NULL, - iuid NUMBER NOT NULL, - igid NUMBER NOT NULL, - isize NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - imtime DATE NOT NULL, - ivalue LONG RAW -); - --- --- Name: t_tags; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE t_tags ( - ipnfsid CHAR(36) NOT NULL, - itagname VARCHAR(255) NOT NULL, - itagid CHAR(36) NOT NULL, - isorign NUMBER NOT NULL, - PRIMARY KEY (ipnfsid, itagname), - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - FOREIGN KEY (itagid) REFERENCES t_tags_inodes( itagid ) -); - --- --- populate Inodes --- - -INSERT INTO t_inodes VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', 16384, 493, 2, 0, 0, 512, 0, current_DATE, current_DATE, current_DATE ); -INSERT INTO t_inodes VALUES ('000000000000000000000000000000000000', 16384, 493, 6, 0, 0, 512, 0, current_DATE, current_DATE, current_DATE ); -INSERT INTO t_inodes VALUES ('A0D739870178504FF109C52075F44287F9DE', 16384, 493, 4, 0, 0, 512, 0, current_DATE, current_DATE, current_DATE ); -INSERT INTO t_inodes VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 16384, 493, 6, 0, 0, 512, 1, current_DATE, current_DATE, current_DATE ); -INSERT INTO t_inodes VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', 16384, 493, 2, 0, 0, 512, 1, current_DATE, current_DATE, current_DATE ); -INSERT INTO t_inodes VALUES ('80D1B8B90CED30430608C58002811B3285FC', 16384, 493, 2, 0, 0, 512, 1, current_DATE, current_DATE, current_DATE ); - --- --- directory --- - -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', '.', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', 'admin','A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', '.', 'A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('000000000000000000000000000000000000', 'usr', 'F674EC8B0CFF104AA109828000696CAD6CAC'); -INSERT INTO t_dirs VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', '.', 'F674EC8B0CFF104AA109828000696CAD6CAC'); -INSERT INTO t_dirs VALUES ('F674EC8B0CFF104AA109828000696CAD6CAC', '..', '000000000000000000000000000000000000'); -INSERT INTO t_dirs VALUES ('A0D739870178504FF109C52075F44287F9DE', 'etc', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', '.', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', '..', 'A0D739870178504FF109C52075F44287F9DE'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 'config','80D1B8B90CED30430608C58002811B3285FC'); -INSERT INTO t_dirs VALUES ('80D1B8B90CED30430608C58002811B3285FC', '.', '80D1B8B90CED30430608C58002811B3285FC'); -INSERT INTO t_dirs VALUES ('80D1B8B90CED30430608C58002811B3285FC', '..', '1B3BB44C05C9904DFB0928F06F2467395CD5'); -INSERT INTO t_dirs VALUES ('1B3BB44C05C9904DFB0928F06F2467395CD5', 'exports','E3BB936F04F6D047A70B75201EDBA32FA9F5'); -INSERT INTO t_dirs VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', '.', 'E3BB936F04F6D047A70B75201EDBA32FA9F5'); -INSERT INTO t_dirs VALUES ('E3BB936F04F6D047A70B75201EDBA32FA9F5', '..', '1B3BB44C05C9904DFB0928F06F2467395CD5'); - - --- --- For faster lookups --- - -CREATE INDEX i_dirs_iparent ON t_dirs(iparent); - --- --- For faster getparent --- - -CREATE INDEX i_dirs_ipnfsid ON t_dirs(ipnfsid); - - --- STORAGE INFO --- --- Generic storage information. Represents X:Y@Z + AL +RP --- ipnfsid : pnfsid of the inode --- ihsmName : Z-component of storageGroup --- istorageGroup : X-component of storageGroup --- istorageSubGroup : Y-component of storageGroup --- iaccessLatency : ONLINE / NEARLINE ( keep on disk / keep on disk, if there is a space) --- iretentionPolicy : CUSTODIAL / OUTPUT ( tape / disk ) - - -CREATE TABLE t_storageinfo ( - ipnfsid CHAR(36) PRIMARY KEY, - ihsmName VARCHAR(64) NOT NULL, - istorageGroup VARCHAR(64) NOT NULL, - istorageSubGroup VARCHAR(64) NOT NULL, - iaccessLatency NUMBER NOT NULL, - iretentionPolicy NUMBER NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ) -); - - --- LOCATION INFO --- --- Generic storage information --- ipnfsid : pnfsid of the inode --- itype : type of storage, e.g. tape, disk --- ilocation : type specific information like pool name for disk and HSM connetion for tape --- ipriority : in case of multiple locations of hint for performance or other needs --- ictime : location creation time --- iatime : last access time, probably performance killer, but nice to have for statistics --- istate : location status ONLINE/OFF-LINE - - -CREATE TABLE t_locationinfo ( - ipnfsid CHAR(36), - itype NUMBER NOT NULL, - ilocation VARCHAR(1024) NOT NULL, - ipriority NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - istate NUMBER NOT NULL, - FOREIGN KEY (ipnfsid) REFERENCES t_inodes( ipnfsid ), - PRIMARY KEY (ipnfsid,itype,ilocation) -); - --- --- removed locations --- required for HSM and pools cleanup --- - -CREATE TABLE t_locationinfo_trash ( - ipnfsid CHAR(36), - itype NUMBER NOT NULL, - ilocation VARCHAR(1024) NOT NULL, - ipriority NUMBER NOT NULL, - ictime DATE NOT NULL, - iatime DATE NOT NULL, - istate NUMBER NOT NULL, - PRIMARY KEY (ipnfsid,itype,ilocation) -); - -CREATE INDEX i_locationinfo_ipnfsid ON t_locationinfo(ipnfsid); - diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/migrate-2-1.9.3.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/migrate-2-1.9.3.sql deleted file mode 100644 index 7c591a3e496..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/migrate-2-1.9.3.sql +++ /dev/null @@ -1,27 +0,0 @@ --- --- convert pre 1.9.2 db schema to the new one --- - --- --- create new tables and populate them --- -CREATE TABLE t_access_latency AS SELECT ipnfsid, iaccessLatency FROM t_storageinfo; -CREATE TABLE t_retention_policy AS SELECT ipnfsid, iretentionPolicy FROM t_storageinfo; - - --- --- remove obsolete columns --- -ALTER TABLE t_storageinfo DROP COLUMN iretentionpolicy ; -ALTER TABLE t_storageinfo DROP COLUMN iaccesslatency ; - - --- --- add foreign key: --- --- remove entry when inode is removed --- -ALTER TABLE ONLY t_access_latency ADD CONSTRAINT t_access_latency_ipnfsid_fkey - FOREIGN KEY (ipnfsid) REFERENCES t_inodes(ipnfsid) ON DELETE CASCADE; -ALTER TABLE ONLY t_retention_policy ADD CONSTRAINT t_retention_policy_ipnfsid_fkey - FOREIGN KEY (ipnfsid) REFERENCES t_inodes(ipnfsid) ON DELETE CASCADE; diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/pgsql-procedures.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/pgsql-procedures.sql deleted file mode 100644 index 2049917ff18..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/pgsql-procedures.sql +++ /dev/null @@ -1,249 +0,0 @@ --- $Id: pgsql-procedures.sql 796 2008-09-05 13:40:45Z tigran $ --- some procedures to push some work to SQL server - -CREATE OR REPLACE FUNCTION "public"."inode2path" (varchar) RETURNS varchar AS $$ -DECLARE - inode VARCHAR := $1; - ipath varchar := ''; - ichain RECORD; -BEGIN - - LOOP - SELECT INTO ichain * FROM t_dirs WHERE ipnfsid=inode AND iname != '.' AND iname != '..'; - IF FOUND AND ichain.iparent != inode - THEN - ipath := '/' || ichain.iname || ipath; - inode := ichain.iparent; - ELSE - EXIT; - END IF; - - END LOOP; - - RETURN ipath; -END; -$$ -LANGUAGE 'plpgsql'; - -CREATE OR REPLACE FUNCTION path2inode(root varchar, path varchar) RETURNS varchar AS $$ -DECLARE - id varchar := root; - elements varchar[] := string_to_array(path, '/'); - child varchar; - itype integer; - link varchar; -BEGIN - FOR i IN 1..array_upper(elements,1) LOOP - SELECT dir.ipnfsid, inode.itype INTO child, itype FROM t_dirs dir, t_inodes inode WHERE dir.ipnfsid = inode.ipnfsid AND dir.iparent=id AND dir.iname=elements[i]; - IF itype=40960 THEN - SELECT ifiledata INTO link FROM t_inodes_data WHERE ipnfsid=child; - IF link LIKE '/%' THEN - child := path2inode('000000000000000000000000000000000000', - substring(link from 2)); - ELSE - child := path2inode(id, link); - END IF; - END IF; - IF child IS NULL THEN - RETURN NULL; - END IF; - id := child; - END LOOP; - RETURN id; -END; -$$ LANGUAGE plpgsql; - -CREATE OR REPLACE FUNCTION - path2inodes(root varchar, path varchar, OUT inode t_inodes) -RETURNS SETOF t_inodes AS $$ -DECLARE - dir varchar; - elements text[] := string_to_array(path, '/'); - inodes t_inodes[]; - link varchar; -BEGIN - -- Find the inode of the root - SELECT * INTO inode FROM t_inodes WHERE ipnfsid = root; - IF NOT FOUND THEN - RETURN; - END IF; - - -- We build an array of the inodes for the path - inodes := ARRAY[inode]; - - -- For each path element - FOR i IN 1..array_upper(elements,1) LOOP - -- Return empty set if not a directory - IF inode.itype != 16384 THEN - RETURN; - END IF; - - -- The PNFS ID of the directory - dir := inode.ipnfsid; - - -- Lookup the next path element - SELECT t_inodes.* INTO inode - FROM t_inodes, t_dirs - WHERE t_inodes.ipnfsid = t_dirs.ipnfsid - AND t_dirs.iparent = dir AND iname = elements[i]; - - -- Return the empty set if not found - IF NOT FOUND THEN - RETURN; - END IF; - - -- Append the inode to the result set - inodes := array_append(inodes, inode); - - -- If inode is a symbolic link - IF inode.itype = 40960 THEN - -- Read the link - SELECT ifiledata INTO STRICT link - FROM t_inodes_data WHERE ipnfsid = inode.ipnfsid; - - -- If absolute path then resolve from the file system root - IF link LIKE '/%' THEN - dir := '000000000000000000000000000000000000'; - link := substring(link from 2); - - -- Call recursively and add inodes to result set - FOR inode IN SELECT * FROM path2inodes(dir, link) LOOP - inodes := array_append(inodes, inode); - END LOOP; - ELSE - -- Call recursively and add inodes to result set; skip - -- first inode as it is the inode of dir - FOR inode IN SELECT * FROM path2inodes(dir, link) OFFSET 1 LOOP - inodes := array_append(inodes, inode); - END LOOP; - END IF; - - -- Return empty set if link could not be resolved - IF NOT FOUND THEN - RETURN; - END IF; - - -- Continue from the inode pointed to by the link - inode = inodes[array_upper(inodes,1)]; - END IF; - END LOOP; - - -- Output all inodes - FOR i IN 1..array_upper(inodes,1) LOOP - inode := inodes[i]; - RETURN NEXT; - END LOOP; -END; -$$ LANGUAGE plpgsql; - --- --- store location of deleted inodes in trash table --- --- stores a old values into the trash table except last access time, --- which replaced with a time, when the trigger was running --- - -CREATE OR REPLACE FUNCTION f_locationinfo2trash() RETURNS TRIGGER AS $t_inodes_trash$ -BEGIN - - IF (TG_OP = 'DELETE') THEN - - INSERT INTO t_locationinfo_trash SELECT - ipnfsid , - itype, - ilocation , - ipriority, - ictime , - iatime , - istate FROM t_locationinfo WHERE ipnfsid = OLD.ipnfsid; - - END IF; - - RETURN OLD; -END; - -$t_inodes_trash$ LANGUAGE plpgsql; - - --- --- trigger to store removed inodes --- - -CREATE TRIGGER tgr_locationinfo_trash BEFORE DELETE ON t_inodes FOR EACH ROW EXECUTE PROCEDURE f_locationinfo2trash(); - - ---- ---- populate inhereted tags ---- -CREATE OR REPLACE FUNCTION f_populate_tags() RETURNS TRIGGER AS $t_populate_tags$ -BEGIN - IF TG_OP = 'INSERT' AND NEW.iname = '..' - THEN - INSERT INTO t_tags ( SELECT NEW.iparent, itagname, itagid, 0 from t_tags WHERE ipnfsid=NEW.ipnfsid ); - END IF; - - RETURN NEW; -END; - -$t_populate_tags$ LANGUAGE plpgsql; --- --- trigger to store removed inodes --- - -CREATE TRIGGER tgr_populate_tags AFTER INSERT ON t_dirs FOR EACH ROW EXECUTE PROCEDURE f_populate_tags(); - --- --- ******** ACL in dCache ********** --- - -------------------------------------------------------------------------------- --- trigger to inherit ACLs for newly created file/directory - -------------------------------------------------------------------------------- --- optimized by mdavid --- -CREATE SEQUENCE serial MINVALUE 0; - -CREATE OR REPLACE FUNCTION f_insertACL() RETURNS trigger AS $$ -DECLARE - msk INTEGER; - flag INTEGER; - rstype INTEGER; - id character(36); - parentid character(36); - -BEGIN - IF (TG_OP = 'INSERT') THEN - msk := 0; - SELECT INTO rstype itype FROM t_inodes WHERE ipnfsid = NEW.ipnfsid; - - IF rstype = 32768 THEN - id := NEW.ipnfsid; - parentid := NEW.iparent; - rstype := 1; -- inserted object is a file - flag := 1; -- check flags for 'f' bit - msk := 11; -- mask contains 'o','d' and 'f' bits - - ELSIF (rstype = 16384 AND NEW.iname = '..') THEN - id := NEW.iparent; - parentid := NEW.ipnfsid; - rstype := 0; -- inserted object is a directory - flag := 3; -- check flags for 'd' and 'f' bits - msk := 8; -- mask contains 'o' bit - END IF; - - IF msk > 0 THEN - ALTER SEQUENCE serial START 0; - - INSERT INTO t_acl - SELECT id, rstype, type, (flags | msk) # msk, access_msk, who, who_id, address_msk, nextval('serial') - FROM t_acl - WHERE rs_id = parentid AND (flags & flag > 0) - ORDER BY ace_order; - END IF; - END IF; - RETURN NULL; -END; -$$ LANGUAGE plpgsql; - -CREATE TRIGGER tgr_insertACL AFTER INSERT ON t_dirs FOR EACH ROW EXECUTE PROCEDURE f_insertACL(); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/pnfsid-mapping.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/pnfsid-mapping.sql deleted file mode 100644 index 16c4dcb1460..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/pnfsid-mapping.sql +++ /dev/null @@ -1,6 +0,0 @@ - - -CREATE TABLE t_pnfsid_mapping ( - ipnfsid CHAR(24) PRIMARY KEY, - ichimeraid CHAR(36) UNIQUE NOT NULL -); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/top_dir.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/top_dir.sql deleted file mode 100644 index 4dc41979830..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/top_dir.sql +++ /dev/null @@ -1,6 +0,0 @@ --- $Id: top_dir.sql 297 2007-10-30 21:13:05Z tigran $ - --- top dir -SELECT iparent, COUNT(iparent) AS pcount FROM t_dirs GROUP BY iparent ORDER BY pcount; --- file of user uid 3750 -SELECT * FROM t_inodes WHERE iuid=3750 AND NOT (imode & 16384 = 16384 ); diff --git a/modules/chimera/src/main/resources/org/dcache/chimera/sql/transaction-loggin-pg.sql b/modules/chimera/src/main/resources/org/dcache/chimera/sql/transaction-loggin-pg.sql deleted file mode 100644 index f17a59eaa42..00000000000 --- a/modules/chimera/src/main/resources/org/dcache/chimera/sql/transaction-loggin-pg.sql +++ /dev/null @@ -1,129 +0,0 @@ --- --- $Id: transaction-loggin-pg.sql 296 2007-10-30 21:09:30Z tigran $ --- transaction logging --- - -CREATE TABLE t_inodes_actionlog ( - iaction varchar(64) NOT NULL, - ittime timestamp without time zone NOT NULL, - ipnfsid character(36) NOT NULL, - itype_old integer , - itype_new integer NOT NULL, - imode_old integer , - imode_new integer NOT NULL, - inlink_old integer , - inlink_new integer NOT NULL, - iuid_old integer , - iuid_new integer NOT NULL, - igid_old integer , - igid_new integer NOT NULL, - isize_old bigint , - isize_new bigint NOT NULL, - iio_old integer , - iio_new integer NOT NULL, - ictime_old timestamp without time zone , - ictime_new timestamp without time zone NOT NULL, - iatime_old timestamp without time zone , - iatime_new timestamp without time zone NOT NULL, - imtime_old timestamp without time zone , - imtime_new timestamp without time zone NOT NULL -); - - - -CREATE OR REPLACE FUNCTION f_actionlog() RETURNS TRIGGER AS $t_actionlog$ -BEGIN - - IF (TG_OP = 'UPDATE') THEN - - INSERT INTO t_inodes_actionlog ( - iaction, - ittime, - ipnfsid, - itype_old, - itype_new, - imode_old, - imode_new, - inlink_old, - inlink_new, - iuid_old, - iuid_new, - igid_old, - igid_new, - isize_old, - isize_new, - iio_old, - iio_new, - ictime_old, - ictime_new, - iatime_old, - iatime_new, - imtime_old, - imtime_new - ) VALUES ( - 'UPDATE', - NOW(), - NEW.ipnfsid, - OLD.itype, - NEW.itype, - OLD.imode, - NEW.imode, - OLD.inlink, - NEW.inlink, - OLD.iuid, - NEW.iuid, - OLD.igid, - NEW.igid, - OLD.isize, - NEW.isize, - OLD.iio, - NEW.iio, - OLD.ictime, - NEW.ictime, - OLD.iatime, - NEW.iatime, - OLD.imtime, - NEW.imtime - ); - - ELSIF (TG_OP = 'INSERT') THEN - - INSERT INTO t_inodes_actionlog ( - iaction, - ittime, - ipnfsid, - itype_new, - imode_new, - inlink_new, - iuid_new, - igid_new, - isize_new, - iio_new, - ictime_new, - iatime_new, - imtime_new - ) VALUES ( - 'INSERT', - NOW(), - NEW.ipnfsid, - NEW.itype, - NEW.imode, - NEW.inlink, - NEW.iuid, - NEW.igid, - NEW.isize, - NEW.iio, - NEW.ictime, - NEW.iatime, - NEW.imtime - ); - - END IF; - - RETURN NEW; -END ; - -$t_actionlog$ LANGUAGE plpgsql; - - -CREATE TRIGGER tgr_actionlog BEFORE INSERT OR UPDATE ON t_inodes FOR EACH ROW EXECUTE PROCEDURE f_actionlog(); \ No newline at end of file