Commit 12175c2f authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

Bug #103370: The logic to resume recall jobs after an unmount is broken

when dealing with double copy recalls.

Proper fix by defining a new RECALLJOB_SELECTED2NDCOPY state instead
of hijacking the (deprecated) fileTransactionId.
parent e557d6a5
......@@ -581,7 +581,7 @@ END;
/
ALTER TABLE RecallJob
ADD CONSTRAINT CK_RecallJob_Status
CHECK (status IN (1, 2, 3));
CHECK (status IN (1, 2, 3, 4));
/* Definition of the TapePool table
* name : the name of the TapePool
......
......@@ -39,6 +39,7 @@ AS
RECALLJOB_PENDING CONSTANT PLS_INTEGER := 1;
RECALLJOB_SELECTED CONSTANT PLS_INTEGER := 2;
RECALLJOB_RETRYMOUNT CONSTANT PLS_INTEGER := 3;
RECALLJOB_SELECTED2NDCOPY CONSTANT PLS_INTEGER := 4;
MIGRATIONMOUNT_WAITTAPE CONSTANT PLS_INTEGER := 0;
MIGRATIONMOUNT_SEND_TO_VDQM CONSTANT PLS_INTEGER := 1;
......
......@@ -111,12 +111,12 @@ EXCEPTION WHEN NO_DATA_FOUND THEN
-- it was a recall mount
-- find and reset the all RecallJobs of files for this VID
UPDATE RecallJob
SET status = tconst.RECALLJOB_PENDING,
fileTransactionId = NULL
SET status = tconst.RECALLJOB_PENDING
WHERE castorFile IN (SELECT castorFile
FROM RecallJob
WHERE VID = varVID
AND (fileTransactionId IS NOT NULL OR status = tconst.RECALLJOB_RETRYMOUNT));
AND (status = tconst.RECALLJOB_SELECTED
OR status = tconst.RECALLJOB_RETRYMOUNT));
DELETE FROM RecallMount WHERE vid = varVID;
EXCEPTION WHEN NO_DATA_FOUND THEN
-- Small infusion of paranoia ;-) We should never reach that point...
......@@ -577,7 +577,8 @@ BEGIN
WHERE RecallMount.mountTransactionId = inMountTransactionId
AND RecallJob.vid = RecallMount.vid
AND RecallJob.fseq = inFseq
AND RecallJob.status = tconst.RECALLJOB_SELECTED
AND (RecallJob.status = tconst.RECALLJOB_SELECTED
OR RecallJob.status = tconst.tconst.RECALLJOB_SELECTED2NDCOPY)
AND RecallJob.castorFile = CastorFile.id
AND ROWNUM < 2
FOR UPDATE OF CastorFile.id;
......@@ -692,8 +693,7 @@ BEGIN
-- increase retry counters within mount and set recallJob status to NEW
UPDATE RecallJob
SET nbRetriesWithinMount = nbRetriesWithinMount + 1,
status = tconst.RECALLJOB_PENDING,
fileTransactionId = NULL
status = tconst.RECALLJOB_PENDING
WHERE castorFile = inCfId
AND VID = inVID;
-- detect the RecallJobs with too many retries within this mount
......@@ -1715,7 +1715,7 @@ BEGIN
RETURNING fileTransactionId INTO varFileTrId;
-- update RecallJobs of this file. Only the recalled one gets a fileTransactionId
UPDATE RecallJob
SET status = tconst.RECALLJOB_SELECTED,
SET status = CASE WHEN id = varRjId THEN tconst.RECALLJOB_SELECTED ELSE tconst.RECALLJOB_SELECTED2NDCOPY END,
fileTransactionID = CASE WHEN id = varRjId THEN varFileTrId ELSE NULL END
WHERE castorFile = varCfId;
IF varCount >= inCount OR varTotalSize >= inTotalSize THEN
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment