Commit 6b16658c authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

[CASTOR migration] Added dirs' depth in intermediate tables

parent c0d01864
......@@ -34,8 +34,11 @@ CREATE TABLE CTAFilesHelper (fileid INTEGER NOT NULL PRIMARY KEY, parent_fileid
CREATE INDEX I_CTAFiles_parent_id ON CTAFilesHelper (parent_fileid);
CREATE INDEX I_CTAFiles_vid_filesize ON CTAFilesHelper (vid, filesize);
CREATE TABLE CTADirsHelper (fileid INTEGER NOT NULL PRIMARY KEY, path VARCHAR2(2048), disk_uid INTEGER, disk_gid INTEGER,
filemode INTEGER, btime INTEGER, ctime INTEGER, mtime INTEGER, classid INTEGER);
CREATE TABLE CTADirsHelper (fileid INTEGER NOT NULL PRIMARY KEY, parent_fileid INTEGER, depth INTEGER,
path VARCHAR2(2048), disk_uid INTEGER, disk_gid INTEGER, filemode INTEGER,
btime INTEGER, ctime INTEGER, mtime INTEGER, classid INTEGER);
CREATE INDEX I_CTADirs_parent_id ON CTADirsHelper (parent_fileid);
CREATE INDEX I_CTADirs_depth ON CTADirsHelper (depth);
-- Temporary table internally used by filesAndDirsForCTAExport
CREATE GLOBAL TEMPORARY TABLE DirIdsForCTA (fileId INTEGER NOT NULL PRIMARY KEY) ON COMMIT PRESERVE ROWS;
......@@ -118,7 +121,8 @@ BEGIN
INSERT /*+ APPEND PARALLEL(CTADirsHelper) */ INTO CTADirsHelper (
SELECT /*+ PARALLEL(F) PARALLEL(D) PARALLEL(DirIdsForCTA) */
-- strip the /castor/cern.ch prefix from all paths
DISTINCT(F.fileid), substr(nvl(D.path, getPathForFileId(F.fileid)), length('/castor/cern.ch/')) as path,
DISTINCT(F.fileid), F.parent_fileid, D.depth,
substr(nvl(D.path, getPathForFileId(F.fileid)), length('/castor/cern.ch/')) as path,
F.owner_uid disk_uid, F.gid disk_gid,
F.filemode, F.atime, F.ctime, F.mtime, F.fileclass classid -- atime in CASTOR is creation time (#556)
FROM Cns_file_metadata F, Dirs_Full_Path D, DirIdsForCTA
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment