Skip to content
Snippets Groups Projects
Commit af446c06 authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#186 CTA should cope with idle database connections being dropped by the database server

OracleCatalogue::deleteArchiveFileByDiskFileId()  should re-connect to database if connection lost.
parent 8c681978
No related branches found
No related tags found
No related merge requests found
......@@ -340,8 +340,17 @@ void OracleCatalogue::deleteArchiveFileInternal(const std::string &diskInstanceN
//------------------------------------------------------------------------------
void OracleCatalogue::deleteArchiveFileByDiskFileId(const std::string &diskInstanceName, const std::string &diskFileId,
log::LogContext &lc) {
return retryOnLostConnection(m_log, [&]{return deleteArchiveFileByDiskFileIdInternal(diskInstanceName, diskFileId,
lc);}, m_maxTriesToConnect);
}
//------------------------------------------------------------------------------
// deleteArchiveFileByDiskFileIdInternal
//------------------------------------------------------------------------------
void OracleCatalogue::deleteArchiveFileByDiskFileIdInternal(const std::string &diskInstanceName,
const std::string &diskFileId, log::LogContext &lc) {
try {
const char *selectSql =
const char *const selectSql =
"SELECT "
"ARCHIVE_FILE.ARCHIVE_FILE_ID AS ARCHIVE_FILE_ID,"
"ARCHIVE_FILE.DISK_INSTANCE_NAME AS DISK_INSTANCE_NAME,"
......
......@@ -150,6 +150,30 @@ private:
void deleteArchiveFileInternal(const std::string &diskInstanceName, const uint64_t archiveFileId,
log::LogContext &lc);
/**
* Deletes the specified archive file and its associated tape copies from the
* catalogue.
*
* Please note that this method is idempotent. If the file to be deleted does
* not exist in the CTA catalogue then this method returns without error.
*
* This internal method can be re-tried if it throws a LostDatabaseConnection
* exception.
*
* @param diskInstanceName The name of the instance from where the deletion
* request originated
* @param diskFileId The identifier of the source disk file which is unique
* within it's host disk system. Two files from different disk systems may
* have the same identifier. The combination of diskInstanceName and
* diskFileId must be globally unique, in other words unique within the CTA
* catalogue.
* @param lc The log context.
* @return The metadata of the deleted archive file including the metadata of
* the associated and also deleted tape copies.
*/
void deleteArchiveFileByDiskFileIdInternal(const std::string &diskInstanceName, const std::string &diskFileId,
log::LogContext &lc);
/**
* Notifies the catalogue that the specified files have been written to tape.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment