Skip to content
Snippets Groups Projects
Commit 18788622 authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Regenerated oracle creation script after fixing the merge of checkNbReplicas

parent 1eb7515c
No related branches found
No related tags found
No related merge requests found
......@@ -3887,6 +3887,7 @@ CREATE OR REPLACE PROCEDURE checkNbReplicas AS
varCfId INTEGER;
varReplicaNb NUMBER;
varNbFiles NUMBER;
varDidSth BOOLEAN;
BEGIN
-- Loop over the CastorFiles to be processed
LOOP
......@@ -3898,13 +3899,19 @@ BEGIN
-- we can exit, we went though all files to be processed
EXIT;
END IF;
-- Lock the castorfile
SELECT id INTO varCfId FROM CastorFile
WHERE id = varCfId FOR UPDATE;
BEGIN
-- Lock the castorfile
SELECT id INTO varCfId FROM CastorFile
WHERE id = varCfId FOR UPDATE;
EXCEPTION WHEN NO_DATA_FOUND THEN
-- the file was dropped meanwhile, ignore and continue
CONTINUE;
END;
-- Get the max replica number of the service class
SELECT replicaNb INTO varReplicaNb
FROM SvcClass WHERE id = varSvcClassId;
-- Produce a list of diskcopies to invalidate should too many replicas be online.
varDidSth := False;
FOR b IN (SELECT id FROM (
SELECT rownum ind, id FROM (
SELECT * FROM (
......@@ -3952,14 +3959,16 @@ BEGIN
SET status = dconst.DISKCOPY_INVALID,
gcType = dconst.GCTYPE_TOOMANYREPLICAS
WHERE id = b.id;
varDidSth := True;
-- update importance of remaining diskcopies
UPDATE DiskCopy SET importance = importance + 1
WHERE castorFile = varCfId
AND status = dconst.DISKCOPY_VALID;
END LOOP;
-- either commit the deletions or release the lock on castorFile
COMMIT;
IF varDidSth THEN COMMIT; END IF;
END LOOP;
-- commit the deletions in case no modification was done that commited them before
COMMIT;
END;
/
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment