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
ed589881
Commit
ed589881
authored
Dec 03, 2014
by
Sebastien Ponce
Browse files
Fixed Bug CASTOR-4849 : Issues with aborting when the same file is mentioned more than once
parent
9043c1f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
castor/db/oracleStager.sql
View file @
ed589881
...
...
@@ -896,23 +896,31 @@ BEGIN
-- handle the case of selective abort
FOR
i
IN
fileIds
.
FIRST
..
fileIds
.
LAST
LOOP
DECLARE
srId
NUMBER
;
cfId
NUMBER
;
srUuid
VARCHAR
(
2048
);
CONSTRAINT_VIOLATED
EXCEPTION
;
PRAGMA
EXCEPTION_INIT
(
CONSTRAINT_VIOLATED
,
-
1
);
BEGIN
SELECT
/*+ INDEX_RS_ASC(Subrequest I_Subrequest_CastorFile)*/
SubRequest
.
id
,
CastorFile
.
id
,
SubRequest
.
subreqId
INTO
srId
,
cfId
,
srUuid
FROM
SubRequest
,
CastorFile
WHERE
request
=
origReqId
AND
SubRequest
.
castorFile
=
CastorFile
.
id
AND
CastorFile
.
fileid
=
fileIds
(
i
)
AND
CastorFile
.
nsHost
=
nsHosts
(
i
);
INSERT
INTO
processBulkAbortFileReqsHelper
(
srId
,
cfId
,
fileId
,
nsHost
,
uuid
)
VALUES
(
srId
,
cfId
,
fileIds
(
i
),
nsHosts
(
i
),
srUuid
);
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- this fileid/nshost did not exist in the request, send an error back
INSERT
INTO
ProcessBulkRequestHelper
(
fileId
,
nsHost
,
errorCode
,
errorMessage
)
VALUES
(
fileIds
(
i
),
nsHosts
(
i
),
serrno
.
ENOENT
,
'No subRequest found for this fileId/nsHost'
);
-- note that we may insert several rows in one go in case the abort request contains
-- several times the same file
INSERT
INTO
processBulkAbortFileReqsHelper
(
SELECT
/*+ INDEX_RS_ASC(Subrequest I_Subrequest_CastorFile)*/
DISTINCT
SubRequest
.
id
,
CastorFile
.
id
,
fileIds
(
i
),
nsHosts
(
i
),
SubRequest
.
subreqId
FROM
SubRequest
,
CastorFile
WHERE
request
=
origReqId
AND
SubRequest
.
castorFile
=
CastorFile
.
id
AND
CastorFile
.
fileid
=
fileIds
(
i
)
AND
CastorFile
.
nsHost
=
nsHosts
(
i
));
-- check that we found something
IF
SQL
%
ROWCOUNT
=
0
THEN
-- this fileid/nshost did not exist in the request, send an error back
INSERT
INTO
ProcessBulkRequestHelper
(
fileId
,
nsHost
,
errorCode
,
errorMessage
)
VALUES
(
fileIds
(
i
),
nsHosts
(
i
),
serrno
.
ENOENT
,
'No subRequest found for this fileId/nsHost'
);
END
IF
;
EXCEPTION
WHEN
CONSTRAINT_VIOLATED
THEN
-- the insertion in ProcessBulkRequestHelper triggered a violation of the
-- primary key. This primary key being the subrequest id, this means that
-- this subrequest is already in the list of the ones to be aborted. So
-- nothing left to be done
NULL
;
END
;
END
LOOP
;
END
IF
;
...
...
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