Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
d1d70a13
Commit
d1d70a13
authored
12 years ago
by
Sebastien Ponce
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug #98412: Fix cleanup of failed diskcopy when they are too numerous
parent
b07d0055
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
castor/db/oracleGC.sql
+28
-30
28 additions, 30 deletions
castor/db/oracleGC.sql
with
28 additions
and
30 deletions
castor/db/oracleGC.sql
+
28
−
30
View file @
d1d70a13
...
@@ -704,38 +704,36 @@ END;
...
@@ -704,38 +704,36 @@ END;
CREATE
OR
REPLACE
PROCEDURE
deleteFailedDiskCopies
(
timeOut
IN
NUMBER
)
AS
CREATE
OR
REPLACE
PROCEDURE
deleteFailedDiskCopies
(
timeOut
IN
NUMBER
)
AS
dcIds
"numList"
;
dcIds
"numList"
;
cfIds
"numList"
;
cfIds
"numList"
;
ct
INTEGER
;
BEGIN
BEGIN
-- select INVALID diskcopies without filesystem (they can exist after a
LOOP
-- s
tageRm that came before the diskcopy had been created on disk) and ALL FAILED
-- s
elect INVALID diskcopies without filesystem (they can exist after a
--
ones (coming from failed recalls or failed removals from the GC daemon).
--
stageRm that came before the diskcopy had been created on disk) and ALL FAILED
-- Note that we don't select INVALID diskcopies from recreation
o
f
file
s
-- ones (coming from failed recalls
o
r
f
a
ile
d removals from the GC daemon).
--
because they are taken by the standard GC as they physically exist on disk.
--
Note that we don't select INVALID diskcopies from recreation of files
SELECT
id
-- because they are taken by the standard GC as they physically exist on disk.
BULK
COLLECT
INTO
dcIds
-- go only for 1000 at a time and retry if the limit was reached
FROM
DiskCopy
SELECT
id
WHERE
(
status
=
4
OR
(
status
=
7
AND
fileSystem
=
0
))
BULK
COLLECT
INTO
dcIds
AND
creationTime
<
getTime
()
-
timeOut
;
FROM
DiskCopy
SELECT
/*+ INDEX(DC PK_DiskCopy_ID) */
UNIQUE
castorFile
WHERE
(
status
=
4
OR
(
status
=
7
AND
fileSystem
=
0
))
BULK
COLLECT
INTO
cfIds
AND
creationTime
<
getTime
()
-
timeOut
FROM
DiskCopy
DC
AND
ROWNUM
<=
1000
;
WHERE
id
IN
(
SELECT
/*+ CARDINALITY(ids 5) */
*
FROM
TABLE
(
dcIds
)
ids
);
SELECT
/*+ INDEX(DC PK_DiskCopy_ID) */
UNIQUE
castorFile
-- drop the DiskCopie
s
BULK
COLLECT
INTO
cfId
s
FORALL
i
IN
1
..
dcIds
.
COUNT
FROM
DiskCopy
DC
DELETE
FROM
DiskCopy
WHERE
id
=
dcIds
(
i
);
WHERE
id
IN
(
SELECT
/*+ CARDINALITY(ids 5) */
*
FROM
TABLE
(
dcIds
)
ids
);
COMMIT
;
-- drop the DiskCopies
-- maybe delete the CastorFiles if nothing is left for them
FORALL
i
IN
1
..
dcIds
.
COUNT
ct
:
=
0
;
DELETE
FROM
DiskCopy
WHERE
id
=
dcIds
(
i
)
;
FOR
i
IN
1
..
cfIds
.
COUNT
LOOP
COMMIT
;
deleteCastorFile
(
cfIds
(
i
));
-- maybe
delete
the
CastorFile
s if nothing is left for them
ct
:
=
ct
+
1
;
FOR
i
IN
1
..
cfIds
.
COUNT
LOOP
IF
ct
=
1000
THEN
deleteCastorFile
(
cfIds
(
i
));
-- commit every 1000, don't pause
END
LOOP
;
ct
:
=
0
;
COMMIT
;
COMMIT
;
-- exit if we did less than 1000
END
IF
;
IF
dcIds
.
COUNT
<
1000
THEN
EXIT
;
END
IF
;
END
LOOP
;
END
LOOP
;
COMMIT
;
END
;
END
;
/
/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment