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
4b4b6b4e
Commit
4b4b6b4e
authored
Jun 16, 2020
by
Cedric Caffy
Browse files
[schema-verify] cta-catalogue-schema-verify displays warning if ERROR logging
tables (ERR$_TABLE_NAME) are found
parent
c8a39cf6
Changes
5
Hide whitespace changes
Inline
Side-by-side
catalogue/DatabaseMetadataGetter.cpp
View file @
4b4b6b4e
...
...
@@ -145,6 +145,13 @@ std::list<std::string> DatabaseMetadataGetter::getTypes() {
return
m_conn
.
getTypeNames
();
}
std
::
list
<
std
::
string
>
DatabaseMetadataGetter
::
getErrorLoggingTables
()
{
std
::
list
<
std
::
string
>
tableNames
=
DatabaseMetadataGetter
::
getTableNames
();
cta
::
utils
::
Regex
regex
(
"(^ERR
\\
$_)"
);
removeObjectNameNotMatches
(
tableNames
,
regex
);
return
tableNames
;
}
DatabaseMetadataGetter
::~
DatabaseMetadataGetter
()
{}
SQLiteDatabaseMetadataGetter
::
SQLiteDatabaseMetadataGetter
(
cta
::
rdbms
::
Conn
&
conn
)
:
DatabaseMetadataGetter
(
conn
){}
...
...
@@ -177,8 +184,8 @@ cta::rdbms::Login::DbType OracleDatabaseMetadataGetter::getDbType(){
std
::
list
<
std
::
string
>
OracleDatabaseMetadataGetter
::
getTableNames
(){
std
::
list
<
std
::
string
>
tableNames
=
DatabaseMetadataGetter
::
getTableNames
();
//Ignore
migration-related
tables
removeObjectName
Containing
(
tableNames
,
{
"ERR$_TAPE_FILE"
,
"TEMP_REMOVE_CASTOR_METADATA"
}
);
//Ignore
error logging
tables
removeObjectName
Matches
(
tableNames
,
cta
::
utils
::
Regex
(
"(^ERR
\\
$_)"
)
);
return
tableNames
;
}
...
...
catalogue/DatabaseMetadataGetter.hpp
View file @
4b4b6b4e
...
...
@@ -65,6 +65,12 @@ class DatabaseMetadataGetter: public MetadataGetter {
virtual
std
::
list
<
std
::
string
>
getStoredProcedures
();
virtual
std
::
list
<
std
::
string
>
getSynonyms
();
virtual
std
::
list
<
std
::
string
>
getTypes
();
/**
* Returns ERROR logging tables.
* (Oracle only : ERR$_TABLE_NAME)
* @return the ERROR logging tables (Oracle only)
*/
virtual
std
::
list
<
std
::
string
>
getErrorLoggingTables
();
};
/**
...
...
catalogue/SchemaChecker.cpp
View file @
4b4b6b4e
...
...
@@ -132,6 +132,15 @@ SchemaCheckerResult SchemaChecker::warnTypes() {
return
res
;
}
SchemaCheckerResult
SchemaChecker
::
warnErrorLoggingTables
()
{
SchemaCheckerResult
res
;
std
::
list
<
std
::
string
>
errorTables
=
m_databaseMetadataGetter
->
getErrorLoggingTables
();
for
(
auto
&
errorTable
:
errorTables
)
{
std
::
string
warning
=
"Error logging table "
+
errorTable
+
" exists in the "
+
m_databaseToCheckName
+
" database"
;
res
.
addWarning
(
warning
);
}
return
res
;
}
/////////////////////////////////////////
// SchemaChecker::Builder
...
...
catalogue/SchemaChecker.hpp
View file @
4b4b6b4e
...
...
@@ -98,6 +98,12 @@ public:
*/
SchemaCheckerResult
warnTypes
();
/**
* Checks if there are error logging tables in the database
* @return a SchemaCheckerResult containing warnings if there are error logging tables in the database
*/
SchemaCheckerResult
warnErrorLoggingTables
();
class
Builder
{
public:
Builder
(
const
std
::
string
databaseToCheckName
,
const
cta
::
rdbms
::
Login
::
DbType
dbType
,
cta
::
rdbms
::
Conn
&
conn
);
...
...
catalogue/VerifySchemaCmd.cpp
View file @
4b4b6b4e
...
...
@@ -86,6 +86,7 @@ int VerifySchemaCmd::exceptionThrowingMain(const int argc, char *const *const ar
result
+=
schemaChecker
->
warnProcedures
();
result
+=
schemaChecker
->
warnSynonyms
();
result
+=
schemaChecker
->
warnTypes
();
result
+=
schemaChecker
->
warnErrorLoggingTables
();
result
.
displayWarnings
(
std
::
cout
);
if
(
result
.
getStatus
()
==
SchemaCheckerResult
::
Status
::
FAILED
){
return
1
;
...
...
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