Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
ad6e02b5
Commit
ad6e02b5
authored
Oct 02, 2020
by
Michael Davis
Browse files
[migration] Updates procedure to rebuild DIRS_FULL_PATH table
parent
d4f79281
Changes
1
Hide whitespace changes
Inline
Side-by-side
migration/castor/castorns_build_dirsfullpath.sql
View file @
ad6e02b5
...
...
@@ -38,11 +38,11 @@ INSERT INTO CTADirsFullPathMigration select a.fileid, a.parent_fileid, '/' || a.
a
.
csumvalue
,
a
.
acl
,
a
.
stagertime
,
a
.
oncta
,
b
.
depth
+
1
,
0
from
CTADirsFullPathNames
a
,
CTADirsFullPathMigration
b
where
a
.
parent_fileid
=
b
.
fileid
and
b
.
depth
=
0
;
/*
Procedure to prepare the files and segments metadata for export to CTA
*/
CREATE
OR
REPLACE
PROCEDURE
build
CTADirsFullPathMigration
AS
Curdepth
INTEGER
;
/*
Table should contain 2 rows at depth 0 and 1
*/
SELECT
*
from
CTADirsFullPathMigration
;
BEGIN
Curdepth
:
=
1
;
FOR
Curdepth
IN
1
..
40
LOOP
INSERT
INTO
CTADirsFullPathMigration
(
SELECT
a
.
fileid
,
a
.
parent_fileid
,
b
.
name
||
'/'
||
a
.
name
,
a
.
filemode
,
a
.
nlink
,
a
.
owner_uid
,
...
...
@@ -51,12 +51,10 @@ BEGIN
FROM
CTADirsFullPathNames
a
,
CTADirsFullPathMigration
b
WHERE
a
.
parent_fileid
=
b
.
fileid
and
b
.
depth
=
Curdepth
);
EXIT
WHEN
sql
%
rowcount
=
0
;
Curdepth
:
=
Curdepth
+
1
;
END
LOOP
;
END
;
EXECUTE
IMMEDIATE
(
'
TRUNCATE TABLE Dirs_Full_Path;
'
);
INSERT
INTO
Dirs_Full_Path
TRUNCATE
TABLE
Dirs_Full_Path
;
INSERT
INTO
Dirs_Full_Path
(
SELECT
fileid
,
parent_fileid
as
parent
,
SUBSTR
(
name
,(
INSTR
(
name
,
'/'
,
-
1
,
1
)
+
1
),
length
(
name
))
as
name
,
name
as
path
,
depth
FROM
CTADirsFullPathMigration
);
END
;
/
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment