Commit 44e3ea20 authored by Eric Cano's avatar Eric Cano
Browse files

Catching up with master branch.

parents b265af99 174ce41f
--------------
- 2.1.14-5-1 -
--------------
Summary
-------
This is a hot fix release that fixes the following bugs:
- #103363: Creation of tape mounts for migration is not resilient to hardware unavailability
- #103370: The logic to resume recall jobs after an unmount is broken when dealing with double copy recalls
- #103387: Incorrect clean up of Disk2diskCopyJobs when they are cancelled
Upgrade Instructions from 2.1.14-5
----------------------------------
Stager
------
The upgrade of the stager database to 2.1.14-5-1 can be performed online while the system is running.
Upgrade the STAGER database using the stager_2.1.14-5_to_2.1.14-5-1.sql script available from:
http://cern.ch/castor/DIST/CERN/savannah/CASTOR.pkg/2.1.14-*/2.1.14-5/dbupgrades.
Other components
----------------
Nothing to be done.
------------
- 2.1.14-5 -
------------
Summary
-------
This release supersedes 2.1.14-4 to fix the GC daemon startup issue plus the following bug:
#103299: Missing tapeStatus value after recalls skews GC
Upgrade Instructions from 2.1.14-4
----------------------------------
Stager
------
The upgrade of the stager database to 2.1.14-5 can be performed online while the system is running.
The RPM upgrade can also be performed on a running system, with 2 restrictions:
- the restart of the RH servers may be noticable by few clients (< 1s downtime);
- the restart of the transfermanagers and diskmanagers should not be done concurrently.
Instructions
------------
1. Upgrade the STAGER database using the stager_2.1.14-4_to_2.1.14-5.sql
upgrade script available from:
- http://cern.ch/castor/DIST/CERN/savannah/CASTOR.pkg/2.1.14-*/2.1.14-5/dbupgrades
2. Upgrade the software on the headnodes.
Note: All daemons involved in the upgrade will be restarted automatically.
3. Upgrade the software on the diskservers.
Note: All daemons involved in the upgrade will be restarted automatically.
4. Test the instance by running the test suite available from:
- http://cern.ch/castor/DIST/CERN/savannah/CASTOR.pkg/2.1.14-*/2.1.14-5/testsuite
5. Congratulations you have successfully upgraded to the 2.1.14-5 release
of CASTOR.
Central services (CUPV, VMGR, VDQM, Nameserver)
-----------------------------------------------
The upgrade of the central databases to 2.1.14-5 can be performed online while
the system is running.
Instructions
------------
1. Apply the appropriate database upgrade script from:
- http://cern.ch/castor/DIST/CERN/savannah/CASTOR.pkg/2.1.14-*/2.1.14-5/dbupgrades
2. Update the software to use the 2.1.14-5 RPMs. Note: All
daemons involved in the upgrade will be restarted automatically.
3. Upgrade complete.
------------
- 2.1.14-4 -
------------
......@@ -5,6 +92,7 @@
Summary
-------
NOTE: the GC daemon is broken in this release. Please install the next one (2.1.14-5) instead.
This is a minor release bringing a number of bug fixes on top of the previous
one.
......
......@@ -380,7 +380,7 @@ BEGIN
replacedDcId, retryCounter, drainingJob
INTO varCfId, varUid, varGid, varDestDcId, varDestSvcClass, varRepType,
varReplacedDcId, varRetryCounter, varDrainingJob
FROM Disk2DiskCopyjob
FROM Disk2DiskCopyJob
WHERE transferId = inTransferId;
-- lock the castor file (and get logging info)
SELECT fileid, nsHost, fileSize INTO varFileId, varNsHost, varFileSize
......@@ -395,6 +395,7 @@ BEGIN
-- So our brand new copy has to be created as invalid to trigger GC.
varNewDcStatus := dconst.DISKCOPY_INVALID;
varLogMsg := dlf.D2D_D2DDONE_CANCEL;
varDestDcId := ids_seq.nextval;
END;
-- check the filesize
IF inReplicaFileSize != varFileSize THEN
......@@ -414,7 +415,7 @@ BEGIN
varComment := varComment || ' replicaFileSize=' || TO_CHAR(inReplicaFileSize) ||
' errorMessage=' || inErrorMessage;
END IF;
logToDLF(NULL, dlf.LVL_SYSTEM, varLogMsg, varFileId, varNsHost, 'stagerd', varComment);
logToDLF(NULL, dlf.LVL_SYSTEM, varLogMsg, varFileId, varNsHost, 'transfermanagerd', varComment);
-- if success, create new DiskCopy, restart waiting requests, cleanup and handle replicate on close
IF inErrorMessage IS NULL THEN
-- get filesystem of the diskcopy and parse diskcopy path
......
......@@ -111,11 +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
SET status = tconst.RECALLJOB_PENDING,
fileTransactionId = NULL
WHERE castorFile IN (SELECT castorFile
FROM RecallJob
WHERE VID = varVID
AND fileTransactionId IS NOT NULL);
AND (fileTransactionId IS NOT NULL 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...
......@@ -154,21 +155,13 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForRecall(inCfId IN INTEGER, outFilePa
nb NUMBER;
BEGIN
-- try and select a good FileSystem for this recall
FOR f IN (SELECT /*+ INDEX_RS_ASC(Subrequest I_Subrequest_Castorfile)*/
FOR f IN (SELECT /*+ INDEX_RS_ASC(RecallJob I_RecallJob_Castorfile_VID) */
DiskServer.name ||':'|| FileSystem.mountPoint AS remotePath, FileSystem.id,
FileSystem.diskserver, CastorFile.fileSize, CastorFile.fileId, CastorFile.nsHost
FROM DiskServer, FileSystem, DiskPool2SvcClass,
(SELECT /*+ INDEX(StageGetRequest PK_StageGetRequest_Id) */ id, svcClass FROM StageGetRequest UNION ALL
SELECT /*+ INDEX(StagePrepareToGetRequest PK_StagePrepareToGetRequest_Id) */ id, svcClass FROM StagePrepareToGetRequest UNION ALL
SELECT /*+ INDEX(StageRepackRequest PK_StageRepackRequest_Id) */ id, svcClass from StageRepackRequest UNION ALL
SELECT /*+ INDEX(StageUpdateRequest PK_StageUpdateRequest_Id) */ id, svcClass from StageUpdateRequest UNION ALL
SELECT /*+ INDEX(StagePrepareToUpdateRequest PK_StagePrepareToUpdateRequ_Id) */ id, svcClass FROM StagePrepareToUpdateRequest) Request,
SubRequest, CastorFile
FROM DiskServer, FileSystem, DiskPool2SvcClass, CastorFile, RecallJob
WHERE CastorFile.id = inCfId
AND SubRequest.castorfile = inCfId
AND SubRequest.status = dconst.SUBREQUEST_WAITTAPERECALL
AND Request.id = SubRequest.request
AND Request.svcclass = DiskPool2SvcClass.child
AND RecallJob.castorFile = inCfId
AND RecallJob.svcclass = DiskPool2SvcClass.child
AND FileSystem.diskpool = DiskPool2SvcClass.parent
-- a priori, we want to have enough free space. However, if we don't, we accept to start writing
-- if we have a minimum of 30GB free and count on gerbage collection to liberate space while writing
......@@ -378,7 +371,9 @@ BEGIN
-- cancel ongoing migrations, if any
deleteMigrationJobs(inCfId);
-- invalidate existing DiskCopies, if any
UPDATE DiskCopy SET status = dconst.DISKCOPY_INVALID
UPDATE DiskCopy
SET status = dconst.DISKCOPY_INVALID,
gcType = dconst.GCTYPE_OVERWRITTEN
WHERE castorFile = inCfId
AND status = dconst.DISKCOPY_VALID;
-- restart ongoing requests
......@@ -460,7 +455,10 @@ BEGIN
-- retrieve data from the namespace: note that if stagerTime is (still) NULL,
-- we're still in compatibility mode and we resolve to using mtime.
-- To be dropped in 2.1.15 where stagerTime is NOT NULL by design.
SELECT NVL(stagerTime, mtime), csumtype, csumvalue, filesize
-- Note the truncation of stagerTime to 5 digits. This is needed for consistency with
-- the stager code that uses the OCCI api and thus loses precision when recuperating
-- 64 bits integers into doubles (lack of support for 64 bits numbers in OCCI)
SELECT NVL(TRUNC(stagertime,5), mtime), csumtype, csumvalue, filesize
INTO varNSOpenTime, varNSCsumtype, varNSCsumvalue, varNSSize
FROM Cns_File_Metadata@RemoteNS
WHERE fileid = inFileId;
......@@ -694,7 +692,8 @@ BEGIN
-- increase retry counters within mount and set recallJob status to NEW
UPDATE RecallJob
SET nbRetriesWithinMount = nbRetriesWithinMount + 1,
status = tconst.RECALLJOB_PENDING
status = tconst.RECALLJOB_PENDING,
fileTransactionId = NULL
WHERE castorFile = inCfId
AND VID = inVID;
-- detect the RecallJobs with too many retries within this mount
......@@ -935,10 +934,13 @@ END;
/* insert new Migration Mount */
CREATE OR REPLACE PROCEDURE insertMigrationMount(inTapePoolId IN NUMBER,
minimumAge IN INTEGER,
outMountId OUT INTEGER) AS
varMigJobId INTEGER;
BEGIN
-- Check that the mount would be honoured by running a dry-run file selection.
-- Check that the mount would be honoured by running a dry-run file selection:
-- note that in case the mount was triggered because of age, we check that
-- we have a valid candidate that is at least minimumAge seconds old.
-- This is almost a duplicate of the query in tg_getFilesToMigrate.
SELECT /*+ FIRST_ROWS_1
LEADING(MigrationJob CastorFile DiskCopy FileSystem DiskServer)
......@@ -950,6 +952,7 @@ BEGIN
FROM MigrationJob, DiskCopy, FileSystem, DiskServer, CastorFile
WHERE MigrationJob.tapePool = inTapePoolId
AND MigrationJob.status = tconst.MIGRATIONJOB_PENDING
AND (minimumAge = 0 OR MigrationJob.creationTime < getTime() - minimumAge)
AND CastorFile.id = MigrationJob.castorFile
AND CastorFile.id = DiskCopy.castorFile
AND CastorFile.tapeStatus = dconst.CASTORFILE_NOTONTAPE
......@@ -1004,7 +1007,7 @@ BEGIN
((varDataAmount/(varTotalNbMounts+1) >= t.minAmountDataForMount) OR
(varNbFiles/(varTotalNbMounts+1) >= t.minNbFilesForMount)) AND
(varTotalNbMounts+1 <= varNbFiles) LOOP -- in case minAmountDataForMount << avgFileSize, stop creating more than one mount per file
insertMigrationMount(t.id, varMountId);
insertMigrationMount(t.id, 0, varMountId);
varTotalNbMounts := varTotalNbMounts + 1;
IF varMountId = 0 THEN
-- log "startMigrationMounts: failed migration mount creation due to lack of files"
......@@ -1032,7 +1035,7 @@ BEGIN
-- force creation of a unique mount in case no mount was created at all and some files are too old
IF varNbFiles > 0 AND varTotalNbMounts = 0 AND t.nbDrives > 0 AND
gettime() - varOldestCreationTime > t.maxFileAgeBeforeMount THEN
insertMigrationMount(t.id, varMountId);
insertMigrationMount(t.id, t.maxFileAgeBeforeMount, varMountId);
IF varMountId = 0 THEN
-- log "startMigrationMounts: failed migration mount creation due to lack of files"
logToDLF(NULL, dlf.LVL_SYSTEM, dlf.MIGMOUNT_AGE_NO_FILE, 0, '', 'tapegatewayd',
......@@ -1112,7 +1115,7 @@ BEGIN
-- log "startRecallMounts: created new recall mount"
logToDLF(NULL, dlf.LVL_SYSTEM, dlf.RECMOUNT_NEW_MOUNT, 0, '', 'tapegatewayd',
'recallGroup=' || rg.name ||
' tape=' || varVid ||
' TPVID=' || varVid ||
' nbExistingMounts=' || TO_CHAR(varNbMounts) ||
' nbNewMountsSoFar=' || TO_CHAR(varNbExtraMounts) ||
' dataAmountInQueue=' || TO_CHAR(varDataAmount) ||
......@@ -1613,8 +1616,7 @@ END;
* input: VDQM transaction id, count and total size
* output: outFiles, a cursor for the set of recall candidates.
*/
create or replace
PROCEDURE tg_getBulkFilesToRecall(inLogContext IN VARCHAR2,
CREATE OR REPLACE PROCEDURE tg_getBulkFilesToRecall(inLogContext IN VARCHAR2,
inMountTrId IN NUMBER,
inCount IN INTEGER,
inTotalSize IN INTEGER,
......
......@@ -328,7 +328,7 @@ ALTER TABLE UpgradeLog
CHECK (type IN ('TRANSPARENT', 'NON TRANSPARENT'));
 
/* SQL statement to populate the intial release value */
INSERT INTO UpgradeLog (schemaVersion, release) VALUES ('-', '2_1_14_4');
INSERT INTO UpgradeLog (schemaVersion, release) VALUES ('-', '2_1_14_5');
 
/* SQL statement to create the CastorVersion view */
CREATE OR REPLACE VIEW CastorVersion
......@@ -9603,6 +9603,7 @@ CREATE OR REPLACE FUNCTION checkRecallInNS(inCfId IN INTEGER,
varNSSize INTEGER;
varNSCsumtype VARCHAR2(2048);
varNSCsumvalue VARCHAR2(2048);
varOpenMode CHAR(1);
BEGIN
-- retrieve data from the namespace: note that if stagerTime is (still) NULL,
-- we're still in compatibility mode and we resolve to using mtime.
......@@ -9611,6 +9612,12 @@ BEGIN
INTO varNSOpenTime, varNSCsumtype, varNSCsumvalue, varNSSize
FROM Cns_File_Metadata@RemoteNS
WHERE fileid = inFileId;
-- check open mode: in compatibility mode we still have only seconds precision,
-- hence the NS open time has to be truncated prior to comparing it with our time.
varOpenMode := getConfigOption@RemoteNS('stager', 'openmode', NULL);
IF varOpenMode = 'C' THEN
varNSOpenTime := TRUNC(varNSOpenTime);
END IF;
-- was the file overwritten in the meantime ?
IF varNSOpenTime > inLastOpenTime THEN
-- yes ! reset it and thus restart the recall from scratch
......@@ -9792,10 +9799,14 @@ BEGIN
WHERE status = tconst.MIGRATIONJOB_WAITINGONRECALL
AND castorFile = varCfId;
varNbMigrationsStarted := SQL%ROWCOUNT;
-- in case there are migrations, update CastorFile's tapeStatus to NOTONTAPE
IF varNbMigrationsStarted > 0 THEN
UPDATE CastorFile SET tapeStatus = dconst.CASTORFILE_NOTONTAPE WHERE id = varCfId;
END IF;
-- in case there are migrations, update CastorFile's tapeStatus to NOTONTAPE, otherwise it is ONTAPE
UPDATE CastorFile
SET tapeStatus = CASE varNbMigrationsStarted
WHEN 0
THEN dconst.CASTORFILE_ONTAPE
ELSE dconst.CASTORFILE_NOTONTAPE
END
WHERE id = varCfId;
 
-- Finally deal with user requests
UPDATE SubRequest
......@@ -11892,7 +11903,7 @@ BEGIN
FROM DrainingJob WHERE status = dconst.DRAININGJOB_RUNNING) LOOP
DECLARE
CONSTRAINT_VIOLATED EXCEPTION;
PRAGMA EXCEPTION_INIT(CONSTRAINT_VIOLATED, -1);
PRAGMA EXCEPTION_INIT(CONSTRAINT_VIOLATED, -1);
BEGIN
-- lock the draining Job first
SELECT id INTO varUnused FROM DrainingJob WHERE id = dj.id FOR UPDATE;
......@@ -11918,7 +11929,7 @@ BEGIN
ORDER BY DiskCopy.importance DESC)
WHERE ROWNUM <= varMaxNbOfSchedD2dPerDrain-varNbRunningJobs) LOOP
createDisk2DiskCopyJob(F.cfId, F.nsOpenTime, dj.svcClass, dj.euid, dj.egid,
dconst.REPLICATIONTYPE_DRAINING, F.dcId, dj.id);
dconst.REPLICATIONTYPE_DRAINING, F.dcId, dj.id, FALSE);
varNbFiles := varNbFiles + 1;
varNbBytes := varNbBytes + F.fileSize;
END LOOP;
......@@ -12008,7 +12019,7 @@ BEGIN
-- create disk2DiskCopyJob for this diskCopy
createDisk2DiskCopyJob(varCfId, varNsOpenTime, inDestSvcClassId,
0, 0, dconst.REPLICATIONTYPE_REBALANCE,
varDcId, NULL);
varDcId, NULL, FALSE);
END LOOP;
CLOSE DCcur;
-- "rebalancing : stopping" message
......
......@@ -187,9 +187,9 @@ castor::stager::daemon::QueryRequestSvcThread::handleFileQueryRequestByFileName
if (result == 0 || result->size() == 0) { // sanity check, result always is != 0
castor::exception::Exception e(ENOENT);
if (svcClassId > 0)
e.getMessage() << "File " << fileName << " not on this service class";
e.getMessage() << "File " << fileName << " not available on this service class";
else
e.getMessage() << "File " << fileName << " not on disk cache";
e.getMessage() << "File " << fileName << " not currently available on the disk cache";
if (result != 0)
delete result;
throw e;
......
......@@ -56,7 +56,7 @@ ALTER TABLE UpgradeLog
CHECK (type IN ('TRANSPARENT', 'NON TRANSPARENT'));
/* SQL statement to populate the intial release value */
INSERT INTO UpgradeLog (schemaVersion, release) VALUES ('-', '2_1_14_4');
INSERT INTO UpgradeLog (schemaVersion, release) VALUES ('-', '2_1_14_5');
/* SQL statement to create the CastorVersion view */
CREATE OR REPLACE VIEW CastorVersion
......
castor (2.1.14-5) unstable; urgency=low
* Fourth 2.1.14 production release
-- Giuseppe Lo Presti <giuseppe.lopresti@cern.ch> Tue, 26 Nov 2013 16:00:00 +0100
castor (2.1.14-4) unstable; urgency=low
* Third 2.1.14 production release
-- Giuseppe Lo Presti <giuseppe.lopresti@cern.ch> Tue, 29 Oct 2013 12:00:00 +0100
-- Giuseppe Lo Presti <giuseppe.lopresti@cern.ch> Fri, 22 Nov 2013 12:00:00 +0100
castor (2.1.14-3) unstable; urgency=low
......
......@@ -30,7 +30,7 @@ import castor_tools
# usage function
def usage(exitCode):
'''prints usage'''
print 'Usage : ' + sys.argv[0] + ' [-h|--help]'
print 'Usage : ' + sys.argv[0] + ' [-h|--help] [-x|--extra]'
sys.exit(exitCode)
# first parse the options
......
......@@ -172,7 +172,7 @@ ALTER TABLE UpgradeLog
CHECK (type IN ('TRANSPARENT', 'NON TRANSPARENT'));
/* SQL statement to populate the intial release value */
INSERT INTO UpgradeLog (schemaVersion, release) VALUES ('-', '2_1_14_4');
INSERT INTO UpgradeLog (schemaVersion, release) VALUES ('-', '2_1_14_5');
/* SQL statement to create the CastorVersion view */
CREATE OR REPLACE VIEW CastorVersion
......
/******************************************************************************
* cns_2.1.14-x_to_2.1.15-0.sql
* cns_2.1.14-4_to_2.1.14-5.sql
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
......@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This script upgrades a CASTOR v2.1.14-x CNS database to v2.1.15-0
* This script upgrades a CASTOR v2.1.14-4 CNS database to v2.1.14-5
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
......@@ -32,7 +32,7 @@ BEGIN
UPDATE UpgradeLog
SET failureCount = failureCount + 1
WHERE schemaVersion = '2_1_14_2'
AND release = '2_1_15_0'
AND release = '2_1_14_5'
AND state != 'COMPLETE';
COMMIT;
END;
......@@ -44,44 +44,38 @@ DECLARE
BEGIN
SELECT release INTO unused FROM CastorVersion
WHERE schemaName = 'CNS'
AND release LIKE '2_1_14%';
AND release LIKE '2_1_14_4%';
EXCEPTION WHEN NO_DATA_FOUND THEN
-- Error, we cannot apply this script
raise_application_error(-20000, 'PL/SQL release mismatch. Please run previous upgrade scripts for the CNS before this one.');
END;
/
/* Verify that the open mode switch has been performed */
DECLARE
openMode VARCHAR(100);
BEGIN
SELECT value INTO openMode FROM CastorConfig
WHERE key = 'openmode';
IF openMode != 'N' THEN
-- Error, we cannot apply this script
raise_application_error(-20000, 'Nameserver Open mode value is '|| openMode ||', not the expected value N(ative). Please run the cns_2.1.14_switch-open-mode.sql script before this one.');
END IF;
END;
INSERT INTO UpgradeLog (schemaVersion, release, type)
VALUES ('2_1_15_0', '2_1_15_0', 'NON TRANSPARENT');
VALUES ('2_1_14_2', '2_1_14_5', 'TRANSPARENT');
COMMIT;
-- Not needed any longer
DELETE FROM CastorConfig WHERE key = 'openmode';
DROP PROCEDURE update2114Data;
-- enforce constraint on stagerTime. This was to be done as part of the post 2.1.14 upgrade phase, but it is not a transparent operation...
ALTER TABLE Cns_file_metadata MODIFY (stagerTime CONSTRAINT NN_File_stagerTime NOT NULL);
/* PL/SQL code update */
/* Recompile all invalid procedures, triggers and functions */
/************************************************************/
BEGIN
FOR a IN (SELECT object_name, object_type
FROM user_objects
WHERE object_type IN ('PROCEDURE', 'TRIGGER', 'FUNCTION', 'VIEW', 'PACKAGE BODY')
AND status = 'INVALID')
LOOP
IF a.object_type = 'PACKAGE BODY' THEN a.object_type := 'PACKAGE'; END IF;
BEGIN
EXECUTE IMMEDIATE 'ALTER ' ||a.object_type||' '||a.object_name||' COMPILE';
EXCEPTION WHEN OTHERS THEN
-- ignore, so that we continue compiling the other invalid items
NULL;
END;
END LOOP;
END;
/
/* Flag the schema upgrade as COMPLETE */
/***************************************/
UPDATE UpgradeLog SET endDate = sysdate, state = 'COMPLETE'
WHERE release = '2_1_15_0';
UPDATE UpgradeLog SET endDate = systimestamp, state = 'COMPLETE'
WHERE release = '2_1_14_5';
COMMIT;
/******************************************************************************
* cupv_2.1.14-4_to_2.1.14-5.sql
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This script upgrades a CASTOR v2.1.14-4 CUPV database to v2.1.14-5
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
/* Stop on errors */
WHENEVER SQLERROR EXIT FAILURE
BEGIN
-- If we have encountered an error rollback any previously non committed
-- operations. This prevents the UPDATE of the UpgradeLog from committing
-- inconsistent data to the database.
ROLLBACK;
UPDATE UpgradeLog
SET failureCount = failureCount + 1
WHERE schemaVersion = '2_1_9_3'
AND release = '2_1_14_5'
AND state != 'COMPLETE';
COMMIT;
END;
/
/* Verify that the script is running against the correct schema and version */
DECLARE
unused VARCHAR(100);
BEGIN
SELECT release INTO unused FROM CastorVersion
WHERE schemaName = 'CUPV'
AND release LIKE '2_1_14_4%';
EXCEPTION WHEN NO_DATA_FOUND THEN
-- Error, we cannot apply this script
raise_application_error(-20000, 'PL/SQL release mismatch. Please run previous upgrade scripts for the CUPV before this one.');
END;
/
INSERT INTO UpgradeLog (schemaVersion, release, type)
VALUES ('2_1_9_3', '2_1_14_5', 'TRANSPARENT');
COMMIT;
/* Recompile all invalid procedures, triggers and functions */
/************************************************************/
BEGIN
FOR a IN (SELECT object_name, object_type
FROM user_objects
WHERE object_type IN ('PROCEDURE', 'TRIGGER', 'FUNCTION', 'VIEW', 'PACKAGE BODY')
AND status = 'INVALID')
LOOP
IF a.object_type = 'PACKAGE BODY' THEN a.object_type := 'PACKAGE'; END IF;
BEGIN
EXECUTE IMMEDIATE 'ALTER ' ||a.object_type||' '||a.object_name||' COMPILE';
EXCEPTION WHEN OTHERS THEN
-- ignore, so that we continue compiling the other invalid items
NULL;
END;
END LOOP;
END;
/
/* Flag the schema upgrade as COMPLETE */
/***************************************/
UPDATE UpgradeLog SET endDate = systimestamp, state = 'COMPLETE'
WHERE release = '2_1_14_5';
COMMIT;
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
* vdqm_2.1.14-4_to_2.1.14-5.sql
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This script upgrades a CASTOR v2.1.14-4 VDQM database to v2.1.14-5
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
/* Stop on errors */
WHENEVER SQLERROR EXIT FAILURE
BEGIN
-- If we have encountered an error rollback any previously non committed
-- operations. This prevents the UPDATE of the UpgradeLog from committing
-- inconsistent data to the database.
ROLLBACK;
UPDATE UpgradeLog
SET failureCount = failureCount + 1
WHERE schemaVersion = '2_1_12_0'
AND release = '2_1_14_5'
AND state != 'COMPLETE';
COMMIT;
END;
/
/* Verify that the script is running against the correct schema and version */
DECLARE
unused VARCHAR(100);
BEGIN
SELECT release INTO unused FROM CastorVersion
WHERE schemaName = 'VDQM'
AND release LIKE '2_1_14_4%';
EXCEPTION WHEN NO_DATA_FOUND THEN
-- Error, we cannot apply this script
raise_application_error(-20000, 'PL/SQL release mismatch. Please run previous upgrade scripts for the VDQM before this one.');
END;
/
INSERT INTO UpgradeLog (schemaVersion, release, type)
VALUES ('2_1_12_0', '2_1_14_5', 'TRANSPARENT');
COMMIT;