Skip to content
Snippets Groups Projects
Commit 4f4c56b4 authored by Dennis Waldron's avatar Dennis Waldron
Browse files

Modified the generation of the accounting information to be trigger by a...

Modified the generation of the accounting information to be trigger by a database job and not a materialized view. This resolves contention and locking issues with the diskserver draining logic. It is not understood why the materialized view did not workcvs diff oracleGC.sql
parent 380cb2ec
Branches
Tags
No related merge requests found
/*******************************************************************
*
* @(#)$RCSfile: oracleCommon.schema.sql,v $ $Revision: 1.7 $ $Date: 2009/03/05 11:56:40 $ $Author: itglp $
* @(#)$RCSfile: oracleCommon.schema.sql,v $ $Revision: 1.8 $ $Date: 2009/03/05 15:33:32 $ $Author: waldron $
*
* This file contains all schema definitions which are not generated automatically.
*
......@@ -394,19 +394,15 @@ INSERT INTO FileSystemsToCheck SELECT id, 0 FROM FileSystem;
/**************/
/* Accounting */
/**************/
CREATE MATERIALIZED VIEW Accounting_MV
BUILD IMMEDIATE
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 60/1440
DISABLE QUERY REWRITE
AS
SELECT owneruid, fileSystem, sum(diskCopySize) totalSize
FROM DiskCopy
WHERE DiskCopy.status IN (0, 10)
AND DiskCopy.owneruid IS NOT NULL
AND DiskCopy.ownergid IS NOT NULL
GROUP BY owneruid, fileSystem;
/* WARNING!!!! Changing this to a materialized view which is refresh at a set
* frequency causes problems with the disk server draining tools.
*/
CREATE TABLE Accounting (euid INTEGER CONSTRAINT NN_Accounting_Euid NOT NULL,
fileSystem INTEGER CONSTRAINT NN_Accounting_Filesystem NOT NULL,
nbBytes INTEGER);
ALTER TABLE Accounting
ADD CONSTRAINT PK_Accounting_EuidFs PRIMARY KEY (euid, fileSystem);
/************************************/
......
/*******************************************************************
*
* @(#)$RCSfile: oracleGC.sql,v $ $Revision: 1.685 $ $Date: 2009/03/05 14:13:55 $ $Author: itglp $
* @(#)$RCSfile: oracleGC.sql,v $ $Revision: 1.686 $ $Date: 2009/03/05 15:33:31 $ $Author: waldron $
*
* PL/SQL code for stager cleanup and garbage collecting
*
......@@ -764,7 +764,8 @@ BEGIN
WHERE job_name IN ('HOUSEKEEPINGJOB',
'CLEANUPJOB',
'BULKCHECKFSBACKINPRODJOB',
'RESTARTSTUCKRECALLSJOB'))
'RESTARTSTUCKRECALLSJOB',
'ACCOUNTINGJOB'))
LOOP
DBMS_SCHEDULER.DROP_JOB(j.job_name, TRUE);
END LOOP;
......@@ -812,6 +813,26 @@ BEGIN
REPEAT_INTERVAL => 'FREQ=MINUTELY; INTERVAL=60',
ENABLED => TRUE,
COMMENTS => 'Workaround to restart stuck recalls');
-- Create a db job to be run every hour that generates the accounting information
DBMS_SCHEDULER.CREATE_JOB(
JOB_NAME => 'accountingJob',
JOB_TYPE => 'PLSQL_BLOCK',
JOB_ACTION => 'BEGIN
DELETE FROM Accounting;
INSERT INTO Accounting (euid, fileSystem, nbBytes)
(SELECT owneruid, fileSystem, sum(diskCopySize)
FROM DiskCopy
WHERE DiskCopy.status IN (0, 10)
AND DiskCopy.owneruid IS NOT NULL
AND DiskCopy.ownergid IS NOT NULL
GROUP BY owneruid, fileSystem);
END;',
JOB_CLASS => 'CASTOR_JOB_CLASS',
START_DATE => SYSDATE + 60/1440,
REPEAT_INTERVAL => 'FREQ=MINUTELY; INTERVAL=60',
ENABLED => TRUE,
COMMENTS => 'Generation of accounting information');
END;
/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment