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
b5b361ba
Commit
b5b361ba
authored
Dec 03, 2008
by
Giulia Taurelli
Browse files
fix in resurrectTapesOnHold
parent
5587f2d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
castor/repack/oracleTrailer.sql
View file @
b5b361ba
/*******************************************************************
*
* @(#)$RCSfile: oracleTrailer.sql,v $ $Revision: 1.1
5
$ $Release$ $Date: 2008/12/0
1
1
3:58:55
$ $Author: gtaur $
* @(#)$RCSfile: oracleTrailer.sql,v $ $Revision: 1.1
6
$ $Release$ $Date: 2008/12/0
3
1
4:03:39
$ $Author: gtaur $
*
* This file contains SQL code that is not generated automatically
* and is inserted at the end of the generated code
...
...
@@ -233,28 +233,31 @@ END;
/
/* PL/SQL method implementing resurrectTapesOnHold */
create
or
replace
PROCEDURE
resurrectTapesOnHold
(
maxFiles
IN
INTEGER
,
maxTapes
IN
INTEGER
)
AS
create
or
replace
PROCEDURE
resurrectTapesOnHold
(
maxFiles
IN
INTEGER
,
maxTapes
IN
INTEGER
)
AS
filesOnGoing
INTEGER
;
tapesOnGoing
INTEGER
;
newFiles
NUMBER
;
BEGIN
SELECT
count
(
vid
),
sum
(
filesStaging
)
+
sum
(
filesMigrating
)
INTO
tapesOnGoing
,
filesOnGoing
FROM
RepackSubrequest
WHERE
status
IN
(
1
,
2
);
-- TOBESTAGED ONGOING
SELECT
count
(
vid
),
sum
(
filesStaging
)
+
sum
(
filesMigrating
)
INTO
tapesOnGoing
,
filesOnGoing
FROM
RepackSubrequest
WHERE
status
IN
(
1
,
2
);
-- TOBESTAGED ONGOING
-- Set the subrequest to TOBESTAGED FROM ON-HOLD if there is no ongoing repack for any of the files on the tape
FOR
sr
IN
(
SELECT
RepackSubRequest
.
id
FROM
RepackSubRequest
,
RepackRequest
WHERE
RepackRequest
.
id
=
RepackSubrequest
.
repackrequest
AND
RepackSubRequest
.
status
=
9
ORDER
BY
RepackRequest
.
creationTime
)
LOOP
BEGIN
FOR
sr
IN
(
SELECT
RepackSubRequest
.
id
FROM
RepackSubRequest
,
RepackRequest
WHERE
RepackRequest
.
id
=
RepackSubrequest
.
repackrequest
AND
RepackSubRequest
.
status
=
9
ORDER
BY
RepackRequest
.
creationTime
)
LOOP
BEGIN
UPDATE
RepackSubRequest
SET
status
=
1
WHERE
id
=
sr
.
id
AND
status
=
9
AND
filesOnGoing
+
files
<=
maxFiles
AND
tapesOnGoing
+
1
<=
maxTapes
AND
NOT
EXISTS
(
SELECT
'x'
FROM
RepackSegment
WHERE
RepackSegment
.
RepackSubRequest
=
sr
.
id
AND
AND
NOT
EXISTS
(
SELECT
'x'
FROM
RepackSegment
WHERE
RepackSegment
.
RepackSubRequest
=
sr
.
id
AND
RepackSegment
.
fileid
IN
(
SELECT
DISTINCT
RepackSegment
.
fileid
FROM
RepackSegment
WHERE
RepackSegment
.
RepackSubrequest
IN
(
SELECT
RepackSubRequest
.
id
FROM
RepackSubRequest
WHERE
RepackSubRequest
.
id
<>
sr
.
id
AND
RepackSubRequest
.
status
NOT
IN
(
4
,
5
,
8
,
9
)
WHERE
RepackSegment
.
RepackSubrequest
IN
(
SELECT
RepackSubRequest
.
id
FROM
RepackSubRequest
WHERE
RepackSubRequest
.
id
<>
sr
.
id
AND
RepackSubRequest
.
status
NOT
IN
(
4
,
5
,
8
,
9
)
)
)
)
)
RETURNING
files
INTO
newFiles
;
-- FINISHED ARCHIVED FAILED ONHOLD
COMMIT
;
filesOnGoing
:
=
filesOnGoing
+
newFiles
;
tapesOnGoing
:
=
tapesOnGoing
+
1
;
IF
newFiles
IS
NOT
NULL
THEN
COMMIT
;
filesOnGoing
:
=
filesOnGoing
+
newFiles
;
tapesOnGoing
:
=
tapesOnGoing
+
1
;
END
IF
;
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
NULL
;
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