Skip to content
GitLab
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
78297531
Commit
78297531
authored
Jan 20, 2005
by
Sebastien Ponce
Browse files
Few fixes in PL/SQL + implemented version checking between the DB and the code
parent
db309bb5
Changes
13
Hide whitespace changes
Inline
Side-by-side
castor/Imakefile
View file @
78297531
...
...
@@ -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.
#
# @(#)$RCSfile: Imakefile,v $ $Revision: 1.7
5
$ $Release$ $Date: 2005/01/
19
1
0
:4
8:59
$ $Author:
bcouturi
$
# @(#)$RCSfile: Imakefile,v $ $Revision: 1.7
6
$ $Release$ $Date: 2005/01/
20
1
7
:4
2:45
$ $Author:
sponcec3
$
#
# Make Castor libraries and executables
#
...
...
@@ -291,6 +291,7 @@ STGLIB_SRCS = IAddressCInt.cpp \
stager/TapePoolCInt.cpp \
stager/TapeStatusCodes.cpp \
stager/TapeCopyStatusCodes.cpp \
exception/BadVersion.cpp \
exception/Exception.cpp \
exception/InvalidArgument.cpp \
exception/Internal.cpp \
...
...
castor/db/ora/OraCnvSvc.cpp
View file @
78297531
...
...
@@ -32,6 +32,7 @@
#include
"castor/SvcFactory.hpp"
#include
"castor/BaseAddress.hpp"
#include
"castor/db/ora/OraBaseObj.hpp"
#include
"castor/exception/BadVersion.hpp"
#include
"castor/exception/Exception.hpp"
#include
"castor/exception/Internal.hpp"
#include
"castor/exception/InvalidArgument.hpp"
...
...
@@ -152,7 +153,34 @@ oracle::occi::Connection* castor::db::ora::OraCnvSvc::getConnection()
m_environment
->
createConnection
(
m_user
,
m_passwd
,
m_dbName
);
clog
()
<<
DEBUG
<<
"Created new Oracle connection : "
<<
m_connection
<<
std
::
endl
;
//oracle::occi::Statement* stmt = m_connection->createStatement
std
::
string
codeVersion
=
"2.0.0.0"
;
std
::
string
DBVersion
=
""
;
oracle
::
occi
::
Statement
*
stmt
=
0
;
try
{
oracle
::
occi
::
Statement
*
stmt
=
m_connection
->
createStatement
(
"SELECT version FROM CastorVersion;"
);
oracle
::
occi
::
ResultSet
*
rset
=
stmt
->
executeQuery
();
if
(
oracle
::
occi
::
ResultSet
::
END_OF_FETCH
!=
rset
->
next
())
{
DBVersion
=
rset
->
getString
(
1
);
}
m_connection
->
terminateStatement
(
stmt
);
if
(
codeVersion
!=
DBVersion
)
{
castor
::
exception
::
BadVersion
e
;
e
.
getMessage
()
<<
"Version mismatch between the database and the code :
\"
"
<<
DBVersion
<<
"
\"
versus
\"
"
<<
codeVersion
<<
"
\"
"
;
throw
e
;
}
}
catch
(
oracle
::
occi
::
SQLException
e
)
{
// No CastorVersion table ?? This means bad version
if
(
0
!=
stmt
)
m_connection
->
terminateStatement
(
stmt
);
castor
::
exception
::
BadVersion
e
;
e
.
getMessage
()
<<
"Not able to find the version of castor in the database"
;
throw
e
;
}
// Uncomment this to unable tracing of the DB
//stmt = m_connection->createStatement
// ("alter session set events '10046 trace name context forever, level 8'");
//stmt->executeUpdate();
//m_connection->terminateStatement(stmt);
...
...
castor/db/oracle.sql
View file @
78297531
...
...
@@ -211,6 +211,11 @@ ALTER TABLE Stream2TapeCopy
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -306,7 +311,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -375,7 +380,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -503,8 +508,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -754,8 +758,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleCommon.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleGC.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleJob.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oraclePerm.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleQuery.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleStager.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleTape.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/db/oracleTrailer.sql
View file @
78297531
/* This file contains SQL code that is not generated automatically */
/* and is inserted at the end of the generated code */
/* A small table used to cross check code and DB versions */
DROP
TABLE
CastorVersion
;
CREATE
TABLE
CastorVersion
(
version
VARCHAR
(
2048
));
INSERT
INTO
CastorVersion
VALUES
(
'2.0.0.0'
);
/* Indexes related to CastorFiles */
CREATE
UNIQUE
INDEX
I_DiskServer_name
on
DiskServer
(
name
);
CREATE
UNIQUE
INDEX
I_CastorFile_fileIdNsHost
on
CastorFile
(
fileId
,
nsHost
);
...
...
@@ -96,7 +101,7 @@ END;
CREATE
OR
REPLACE
PROCEDURE
updateFsWeight
(
ds
IN
INTEGER
,
fs
IN
INTEGER
,
deviation
IN
INTEGER
)
AS
BEGIN
UPDATE
FileSystem
SET
weightDelta
=
weightDelta
-
deviation
UPDATE
FileSystem
SET
deltaWeight
=
deltaWeight
-
deviation
WHERE
diskServer
=
ds
;
UPDATE
FileSystem
SET
fsDeviation
=
2
*
deviation
WHERE
id
=
fs
;
...
...
@@ -165,7 +170,7 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForSegment(segmentId IN INTEGER, diskS
AND
FileSystem
.
status
=
0
-- FILESYSTEM_PRODUCTION
AND
DiskServer
.
id
=
FileSystem
.
diskServer
AND
DiskServer
.
status
=
0
-- DISKSERVER_PRODUCTION
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeig
t
h
DESC
,
ORDER
by
FileSystem
.
weight
+
FileSystem
.
deltaWeigh
t
DESC
,
FileSystem
.
fsDeviation
ASC
;
BEGIN
OPEN
c1
;
...
...
@@ -293,8 +298,7 @@ BEGIN
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
-- No disk copy found on selected FileSystem, look in others
BEGIN
-- Try to find remote DiskCopies
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
,
FileSystem
.
weight
SELECT
DiskCopy
.
id
,
DiskCopy
.
path
,
DiskCopy
.
status
INTO
dci
,
rpath
,
rstatus
FROM
DiskCopy
,
SubRequest
,
FileSystem
,
DiskServer
WHERE
SubRequest
.
id
=
srId
...
...
@@ -544,8 +548,8 @@ CREATE OR REPLACE PROCEDURE bestFileSystemForJob
ds
NUMBER
;
fs
NUMBER
;
dev
NUMBER
;
c1
castor
.
AnyCursor
;
TYPE
AnyCursor
IS
REF
CURSOR
;
c1
castor
.
AnyCursor
;
BEGIN
IF
fileSystems
.
COUNT
>
0
THEN
DECLARE
...
...
castor/exception/BadVersion.cpp
0 → 100644
View file @
78297531
/******************************************************************************
* BadVersion.cpp
*
* 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.
*
* @(#)$RCSfile: BadVersion.cpp,v $ $Revision: 1.1 $ $Release$ $Date: 2005/01/20 17:42:45 $ $Author: sponcec3 $
*
*
*
* @author Sebastien Ponce
*****************************************************************************/
// Include Files
#include
"serrno.h"
#include
"castor/exception/BadVersion.hpp"
// -----------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------
castor
::
exception
::
BadVersion
::
BadVersion
()
:
castor
::
exception
::
Exception
(
SEBADVERSION
)
{}
castor/exception/BadVersion.hpp
0 → 100644
View file @
78297531
/******************************************************************************
* Badversion.hpp
*
* 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.
*
* @(#)$RCSfile: BadVersion.hpp,v $ $Revision: 1.1 $ $Release$ $Date: 2005/01/20 17:42:46 $ $Author: sponcec3 $
*
* Badversion error exception
*
* @author Sebastien Ponce
*****************************************************************************/
#ifndef EXCEPTION_BADVERSION_HPP
#define EXCEPTION_BADVERSION_HPP 1
// Include Files
#include
"castor/exception/Exception.hpp"
namespace
castor
{
namespace
exception
{
/**
* Invalid argument exception
*/
class
BadVersion
:
public
castor
::
exception
::
Exception
{
public:
/**
* default constructor
*/
BadVersion
();
};
}
// end of namespace exception
}
// end of namespace castor
#endif // EXCEPTION_BADVERSION_HPP
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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