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
788d6880
Commit
788d6880
authored
16 years ago
by
Giuseppe Lo Presti
Browse files
Options
Downloads
Patches
Plain Diff
Improved cleanup logic
parent
471ddf72
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
castor/db/oracleGC.sql
+12
-7
12 additions, 7 deletions
castor/db/oracleGC.sql
with
12 additions
and
7 deletions
castor/db/oracleGC.sql
+
12
−
7
View file @
788d6880
/*******************************************************************
*
* @(#)$RCSfile: oracleGC.sql,v $ $Revision: 1.68
6
$ $Date: 2009/03/0
5
1
5:33:31
$ $Author:
waldron
$
* @(#)$RCSfile: oracleGC.sql,v $ $Revision: 1.68
7
$ $Date: 2009/03/0
6
1
7:21:29
$ $Author:
itglp
$
*
* PL/SQL code for stager cleanup and garbage collecting
*
...
...
@@ -562,10 +562,11 @@ BEGIN
-- and keeping a cursor opened on the original select may take
-- too long, leading to ORA-01555 'snapshot too old' errors.
EXECUTE
IMMEDIATE
'TRUNCATE TABLE DeleteTermReqHelper'
;
INSERT
INTO
DeleteTermReqHelper
INSERT
/*+ APPEND */
INTO
DeleteTermReqHelper
(
SELECT
id
,
castorFile
FROM
SubRequest
WHERE
status
IN
(
9
,
11
)
AND
lastModificationTime
<
getTime
()
-
timeOut
);
COMMIT
;
ct
:
=
0
;
FOR
cf
IN
(
SELECT
UNIQUE
cfId
FROM
DeleteTermReqHelper
)
LOOP
deleteCastorFile
(
cf
.
cfId
);
...
...
@@ -581,20 +582,24 @@ BEGIN
-- entries to be deleted, and we use the FORALL logic
-- (cf. bulkDelete) instead of a simple DELETE ...
-- WHERE id IN (SELECT srId FROM DeleteTermReqHelper)
-- for efficiency reasons.
-- for efficiency reasons. Moreover, we don't risk
-- here the ORA-01555 error keeping the cursor open
-- between commits as we are selecting on our
-- temporary table.
DECLARE
CURSOR
s
IS
SELECT
srId
FROM
DeleteTermReqHelper
;
ids
"numList"
;
BEGIN
OPEN
s
;
FETCH
s
BULK
COLLECT
INTO
ids
;
IF
ids
.
COUNT
>
0
THEN
LOOP
FETCH
s
BULK
COLLECT
INTO
ids
LIMIT
10000
;
EXIT
WHEN
s
%
NOTFOUND
;
FORALL
i
IN
ids
.
FIRST
..
ids
.
LAST
DELETE
FROM
SubRequest
WHERE
id
=
ids
(
i
);
END
IF
;
COMMIT
;
END
LOOP
;
CLOSE
s
;
COMMIT
;
END
;
EXECUTE
IMMEDIATE
'TRUNCATE TABLE DeleteTermReqHelper'
;
...
...
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