Commit a04d1d20 authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#144 Don't forget to replace temporary fix for XrdCtaFile::xCom_deletearchive()

This commit does two things.  Firstly it puts back the call from:

    XrdCtaFile::xCom_deletearchive()

to:

    Scheduler::deleteArchive()

Secondly it moves the reponsibility of logging the
"Archive File Deleted" message from the CTA front-end (XrdCtaFile)
to the CTA catalogue.

Please note that Scheduler::deleteArchive() still does not call
SchedulerDatabase::deleteArchiveRequest().
parent 4eb8f471
/*
* The CERN Tape Archive(CTA) project
* Copyright(C) 2015 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/exception/UserError.hpp"
namespace cta {
namespace catalogue {
/**
* Archive file does not exist in the CTA catalogue.
*/
class ArchiveFileDoesNotExist: public exception::UserError {
public:
/**
* The unique identifier of the archive file.
*/
uint64_t archiveFileId;
};
} // namespace catalogue
} // namespace cta
......@@ -18,7 +18,6 @@
#pragma once
#include "catalogue/ArchiveFileDoesNotExist.hpp"
#include "catalogue/ArchiveFileItor.hpp"
#include "catalogue/TapeFileSearchCriteria.hpp"
#include "catalogue/TapeFileWritten.hpp"
......@@ -493,16 +492,16 @@ public:
* prevent a disk instance deleting an archive file that belongs to another
* disk instance.
*
* 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.
*
* @param instanceName The name of the instance from where the deletion request
* originated
* @param archiveFileId The unique identifier of the archive file.
* @return The metadata of the deleted archive file including the metadata of
* the associated and also deleted tape copies.
* @throw catalogue::ArchiveFileDoesNotExist If the specified archive file
* does not exist in the catalogue.
*/
virtual common::dataStructures::ArchiveFile deleteArchiveFile(const std::string &instanceName,
const uint64_t archiveFileId) = 0;
virtual void deleteArchiveFile(const std::string &instanceName, const uint64_t archiveFileId) = 0;
/**
* Returns true if the specified user running the CTA command-line tool on
......
......@@ -6187,46 +6187,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteArchiveFile) {
ASSERT_EQ(file2Written.copyNb, tapeFile2.copyNb);
}
{
const common::dataStructures::ArchiveFile archiveFile = m_catalogue->deleteArchiveFile("disk_instance", archiveFileId);
ASSERT_EQ(file2Written.archiveFileId, archiveFile.archiveFileID);
ASSERT_EQ(file2Written.diskFileId, archiveFile.diskFileId);
ASSERT_EQ(file2Written.size, archiveFile.fileSize);
ASSERT_EQ(file2Written.checksumType, archiveFile.checksumType);
ASSERT_EQ(file2Written.checksumValue, archiveFile.checksumValue);
ASSERT_EQ(file2Written.storageClassName, archiveFile.storageClass);
ASSERT_EQ(file2Written.diskInstance, archiveFile.diskInstance);
ASSERT_EQ(file2Written.diskFilePath, archiveFile.diskFileInfo.path);
ASSERT_EQ(file2Written.diskFileUser, archiveFile.diskFileInfo.owner);
ASSERT_EQ(file2Written.diskFileGroup, archiveFile.diskFileInfo.group);
ASSERT_EQ(file2Written.diskFileRecoveryBlob, archiveFile.diskFileInfo.recoveryBlob);
ASSERT_EQ(2, archiveFile.tapeFiles.size());
auto copyNbToTapeFile1Itor = archiveFile.tapeFiles.find(1);
ASSERT_FALSE(copyNbToTapeFile1Itor == archiveFile.tapeFiles.end());
const common::dataStructures::TapeFile &tapeFile1 = copyNbToTapeFile1Itor->second;
ASSERT_EQ(file1Written.vid, tapeFile1.vid);
ASSERT_EQ(file1Written.fSeq, tapeFile1.fSeq);
ASSERT_EQ(file1Written.blockId, tapeFile1.blockId);
ASSERT_EQ(file1Written.compressedSize, tapeFile1.compressedSize);
ASSERT_EQ(file1Written.checksumType, tapeFile1.checksumType);
ASSERT_EQ(file1Written.checksumValue, tapeFile1.checksumValue);
ASSERT_EQ(file1Written.copyNb, tapeFile1.copyNb);
auto copyNbToTapeFile2Itor = archiveFile.tapeFiles.find(2);
ASSERT_FALSE(copyNbToTapeFile2Itor == archiveFile.tapeFiles.end());
const common::dataStructures::TapeFile &tapeFile2 = copyNbToTapeFile2Itor->second;
ASSERT_EQ(file2Written.vid, tapeFile2.vid);
ASSERT_EQ(file2Written.fSeq, tapeFile2.fSeq);
ASSERT_EQ(file2Written.blockId, tapeFile2.blockId);
ASSERT_EQ(file2Written.compressedSize, tapeFile2.compressedSize);
ASSERT_EQ(file2Written.checksumType, tapeFile2.checksumType);
ASSERT_EQ(file2Written.checksumValue, tapeFile2.checksumValue);
ASSERT_EQ(file2Written.copyNb, tapeFile2.copyNb);
}
m_catalogue->deleteArchiveFile("disk_instance", archiveFileId);
ASSERT_FALSE(m_catalogue->getArchiveFiles().hasMore());
}
......@@ -6543,7 +6504,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteArchiveFile_non_existant) {
using namespace cta;
ASSERT_FALSE(m_catalogue->getArchiveFiles().hasMore());
ASSERT_THROW(m_catalogue->deleteArchiveFile("disk_instance", 12345678), catalogue::ArchiveFileDoesNotExist);
m_catalogue->deleteArchiveFile("disk_instance", 12345678);
}
TEST_P(cta_catalogue_CatalogueTest, getTapesByVid_non_existant_tape) {
......
......@@ -59,8 +59,7 @@ OracleCatalogue::~OracleCatalogue() {
//------------------------------------------------------------------------------
// deleteArchiveFile
//------------------------------------------------------------------------------
common::dataStructures::ArchiveFile OracleCatalogue::deleteArchiveFile(
const std::string &diskInstanceName, const uint64_t archiveFileId) {
void OracleCatalogue::deleteArchiveFile(const std::string &diskInstanceName, const uint64_t archiveFileId) {
try {
const char *selectSql =
"SELECT "
......@@ -132,11 +131,10 @@ common::dataStructures::ArchiveFile OracleCatalogue::deleteArchiveFile(
}
if(nullptr == archiveFile.get()) {
ArchiveFileDoesNotExist e;
e.archiveFileId = archiveFileId;
e.getMessage() << "Failed to delete archive file with ID " << archiveFileId << " from the catalogue because it"
" does not exist in the catalogue";
throw e;
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("fileId", std::to_string(archiveFileId)));
m_log(log::WARNING, "Ignoring request to delete Archive File because it does not exist in the catalogue", params);
return;
}
if(diskInstanceName != archiveFile->diskInstance) {
......@@ -164,7 +162,34 @@ common::dataStructures::ArchiveFile OracleCatalogue::deleteArchiveFile(
conn.commit();
return *archiveFile;
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("fileId", std::to_string(archiveFile->archiveFileID)));
params.push_back(cta::log::Param("diskInstance", archiveFile->diskInstance));
params.push_back(cta::log::Param("diskFileId", archiveFile->diskFileId));
params.push_back(cta::log::Param("diskFileInfo.path", archiveFile->diskFileInfo.path));
params.push_back(cta::log::Param("diskFileInfo.owner", archiveFile->diskFileInfo.owner));
params.push_back(cta::log::Param("diskFileInfo.group", archiveFile->diskFileInfo.group));
params.push_back(cta::log::Param("diskFileInfo.recoveryBlob", archiveFile->diskFileInfo.recoveryBlob));
params.push_back(cta::log::Param("fileSize", std::to_string(archiveFile->fileSize)));
params.push_back(cta::log::Param("checksumType", archiveFile->checksumType));
params.push_back(cta::log::Param("checksumValue", archiveFile->checksumValue));
params.push_back(cta::log::Param("creationTime", std::to_string(archiveFile->creationTime)));
params.push_back(cta::log::Param("reconciliationTime", std::to_string(archiveFile->reconciliationTime)));
params.push_back(cta::log::Param("storageClass", archiveFile->storageClass));
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
params.push_back(cta::log::Param("TAPE FILE", tapeCopyLogStream.str()));
}
m_log(log::INFO, "Archive File Deleted", params);
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
......
......@@ -71,15 +71,16 @@ public:
* prevent a disk instance deleting an archive file that belongs to another
* disk instance.
*
* @param instanceName The name of the instance from where the deletion request originated
* 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.
*
* @param instanceName The name of the instance from where the deletion request
* originated
* @param archiveFileId The unique identifier of the archive file.
* @return The metadata of the deleted archive file including the metadata of
* the associated and also deleted tape copies.
* @throw ArchiveFileDoesNotExistInCatalogue If the specified archive file
* does not exist in the catalogue.
*/
common::dataStructures::ArchiveFile deleteArchiveFile(const std::string &diskInstanceName,
const uint64_t archiveFileId) override;
void deleteArchiveFile(const std::string &diskInstanceName, const uint64_t archiveFileId) override;
/**
* Returns a unique archive ID that can be used by a new archive file within
......
......@@ -54,19 +54,17 @@ SqliteCatalogue::~SqliteCatalogue() {
//------------------------------------------------------------------------------
// deleteArchiveFile
//------------------------------------------------------------------------------
common::dataStructures::ArchiveFile SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName,
const uint64_t archiveFileId) {
void SqliteCatalogue::deleteArchiveFile(const std::string &diskInstanceName, const uint64_t archiveFileId) {
try {
auto conn = m_connPool.getConn();
rdbms::AutoRollback autoRollback(conn);
const auto archiveFile = getArchiveFile(conn, archiveFileId);
if(nullptr == archiveFile.get()) {
ArchiveFileDoesNotExist e;
e.archiveFileId = archiveFileId;
e.getMessage() << "Failed to delete archive file with ID " << archiveFileId << " from the catalogue because it"
" does not exist in the catalogue";
throw e;
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("fileId", std::to_string(archiveFileId)));
m_log(log::WARNING, "Ignoring request to delete Archive File because it does not exist in the catalogue", params);
return;
}
if(diskInstanceName != archiveFile->diskInstance) {
......@@ -94,7 +92,34 @@ common::dataStructures::ArchiveFile SqliteCatalogue::deleteArchiveFile(const std
conn.commit();
return *archiveFile;
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("fileId", std::to_string(archiveFile->archiveFileID)));
params.push_back(cta::log::Param("diskInstance", archiveFile->diskInstance));
params.push_back(cta::log::Param("diskFileId", archiveFile->diskFileId));
params.push_back(cta::log::Param("diskFileInfo.path", archiveFile->diskFileInfo.path));
params.push_back(cta::log::Param("diskFileInfo.owner", archiveFile->diskFileInfo.owner));
params.push_back(cta::log::Param("diskFileInfo.group", archiveFile->diskFileInfo.group));
params.push_back(cta::log::Param("diskFileInfo.recoveryBlob", archiveFile->diskFileInfo.recoveryBlob));
params.push_back(cta::log::Param("fileSize", std::to_string(archiveFile->fileSize)));
params.push_back(cta::log::Param("checksumType", archiveFile->checksumType));
params.push_back(cta::log::Param("checksumValue", archiveFile->checksumValue));
params.push_back(cta::log::Param("creationTime", std::to_string(archiveFile->creationTime)));
params.push_back(cta::log::Param("reconciliationTime", std::to_string(archiveFile->reconciliationTime)));
params.push_back(cta::log::Param("storageClass", archiveFile->storageClass));
for(auto it=archiveFile->tapeFiles.begin(); it!=archiveFile->tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize
<< " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
<< " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
<< " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
params.push_back(cta::log::Param("TAPE FILE", tapeCopyLogStream.str()));
}
m_log(log::INFO, "Archive File Deleted", params);
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
......
......@@ -64,15 +64,16 @@ public:
* prevent a disk instance deleting an archive file that belongs to another
* disk instance.
*
* @param instanceName The name of the instance from where the deletion request originated
* 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.
*
* @param instanceName The name of the instance from where the deletion request
* originated
* @param archiveFileId The unique identifier of the archive file.
* @return The metadata of the deleted archive file including the metadata of
* the associated and also deleted tape copies.
* @throw ArchiveFileDoesNotExistInCatalogue If the specified archive file
* does not exist in the catalogue.
*/
common::dataStructures::ArchiveFile deleteArchiveFile(const std::string &diskInstanceName,
const uint64_t archiveFileId) override;
void deleteArchiveFile(const std::string &diskInstanceName, const uint64_t archiveFileId) override;
protected:
......
......@@ -209,30 +209,27 @@ void Scheduler::queueRetrieve(
//------------------------------------------------------------------------------
// deleteArchive
//------------------------------------------------------------------------------
common::dataStructures::ArchiveFile Scheduler::deleteArchive(const std::string &instanceName, const common::dataStructures::DeleteArchiveRequest &request) {
void Scheduler::deleteArchive(const std::string &instanceName, const common::dataStructures::DeleteArchiveRequest &request) {
// We have different possible scenarios here. The file can be safe in the catalogue,
// fully queued, or partially queued.
// First, make sure the file is not queued anymore.
try {
m_db.deleteArchiveRequest(instanceName, request.archiveFileID);
} catch (exception::Exception &dbEx) {
// The file was apparently not queued. If we fail to remove it from the
// catalogue for any reason other than it does not exist in the catalogue,
// then it is an error.
try {
return m_catalogue.deleteArchiveFile(instanceName, request.archiveFileID);
} catch(catalogue::ArchiveFileDoesNotExist &e) {
return common::dataStructures::ArchiveFile();
} catch(...) {
throw;
}
}
// TEMPORARILY commenting out SchedulerDatabase::deleteArchiveRequest() in order
// to reduce latency. PLEASE NOTE however that this means files "in-flight" to
// tape will not be deleted and they will appear in the CTA catalogue when they
// are finally written to tape.
//try {
// m_db.deleteArchiveRequest(instanceName, request.archiveFileID);
//} catch (exception::Exception &dbEx) {
// // The file was apparently not queued. If we fail to remove it from the
// // catalogue for any reason other than it does not exist in the catalogue,
// // then it is an error.
// m_catalogue.deleteArchiveFile(instanceName, request.archiveFileID);
//}
// We did delete the file from the queue. It hence might be absent from the catalogue.
// Errors are not fatal here (so we filter them out).
try {
return m_catalogue.deleteArchiveFile(instanceName, request.archiveFileID);
m_catalogue.deleteArchiveFile(instanceName, request.archiveFileID);
} catch (exception::UserError &) {}
return common::dataStructures::ArchiveFile();
}
//------------------------------------------------------------------------------
......
......@@ -107,12 +107,11 @@ public:
log::LogContext &lc);
/**
* Delete an archived file or a file which is in the process of being archived. Returns the information
* about the deleted file.
* Delete an archived file or a file which is in the process of being archived.
* Throws a UserError exception in case of wrong request parameters (ex. unknown file id)
* Throws a (Non)RetryableError exception in case something else goes wrong with the request
*/
cta::common::dataStructures::ArchiveFile deleteArchive(const std::string &instanceName,
void deleteArchive(const std::string &instanceName,
const cta::common::dataStructures::DeleteArchiveRequest &request);
/**
......
......@@ -284,70 +284,75 @@ TEST_P(SchedulerTest, archive_to_new_file) {
}
}
TEST_P(SchedulerTest, delete_archive_request) {
using namespace cta;
Scheduler &scheduler = getScheduler();
setupDefaultCatalogue();
cta::common::dataStructures::EntryLog creationLog;
creationLog.host="host2";
creationLog.time=0;
creationLog.username="admin1";
cta::common::dataStructures::DiskFileInfo diskFileInfo;
diskFileInfo.recoveryBlob="blob";
diskFileInfo.group="group2";
diskFileInfo.owner="cms_user";
diskFileInfo.path="path/to/file";
cta::common::dataStructures::ArchiveRequest request;
request.checksumType="ADLER32";
request.checksumValue="1111";
request.creationLog=creationLog;
request.diskFileInfo=diskFileInfo;
request.diskFileID="diskFileID";
request.fileSize=100*1000*1000;
cta::common::dataStructures::UserIdentity requester;
requester.name = s_userName;
requester.group = "userGroup";
request.requester = requester;
request.srcURL="srcURL";
request.storageClass=s_storageClassName;
log::DummyLogger dl("");
log::LogContext lc(dl);
auto archiveFileId = scheduler.queueArchive(s_diskInstance, request, lc);
// Check that we have the file in the queues
// TODO: for this to work all the time, we need an index of all requests
// (otherwise we miss the selected ones).
// Could also be limited to querying by ID (global index needed)
bool found=false;
for (auto & tp: scheduler.getPendingArchiveJobs()) {
for (auto & req: tp.second) {
if (req.archiveFileID == archiveFileId)
found = true;
}
}
ASSERT_TRUE(found);
// Remove the request
cta::common::dataStructures::DeleteArchiveRequest dar;
dar.archiveFileID = archiveFileId;
dar.requester.group = "group1";
dar.requester.name = "user1";
scheduler.deleteArchive("disk_instance", dar);
// Validate that the request is gone.
found=false;
for (auto & tp: scheduler.getPendingArchiveJobs()) {
for (auto & req: tp.second) {
if (req.archiveFileID == archiveFileId)
found = true;
}
}
ASSERT_FALSE(found);
}
// smurray commented this test out on Mon 17 Jul 2017. The test assumes that
// Scheduler::deleteArchive() calls SchedulerDatabase::deleteArchiveRequest().
// This fact is currently not true as Scheduler::deleteArchive() has been
// temporarily modified to only call Catalogue::deleteArchiveFile().
//
//TEST_P(SchedulerTest, delete_archive_request) {
// using namespace cta;
//
// Scheduler &scheduler = getScheduler();
//
// setupDefaultCatalogue();
//
// cta::common::dataStructures::EntryLog creationLog;
// creationLog.host="host2";
// creationLog.time=0;
// creationLog.username="admin1";
// cta::common::dataStructures::DiskFileInfo diskFileInfo;
// diskFileInfo.recoveryBlob="blob";
// diskFileInfo.group="group2";
// diskFileInfo.owner="cms_user";
// diskFileInfo.path="path/to/file";
// cta::common::dataStructures::ArchiveRequest request;
// request.checksumType="ADLER32";
// request.checksumValue="1111";
// request.creationLog=creationLog;
// request.diskFileInfo=diskFileInfo;
// request.diskFileID="diskFileID";
// request.fileSize=100*1000*1000;
// cta::common::dataStructures::UserIdentity requester;
// requester.name = s_userName;
// requester.group = "userGroup";
// request.requester = requester;
// request.srcURL="srcURL";
// request.storageClass=s_storageClassName;
//
// log::DummyLogger dl("");
// log::LogContext lc(dl);
// auto archiveFileId = scheduler.queueArchive(s_diskInstance, request, lc);
//
// // Check that we have the file in the queues
// // TODO: for this to work all the time, we need an index of all requests
// // (otherwise we miss the selected ones).
// // Could also be limited to querying by ID (global index needed)
// bool found=false;
// for (auto & tp: scheduler.getPendingArchiveJobs()) {
// for (auto & req: tp.second) {
// if (req.archiveFileID == archiveFileId)
// found = true;
// }
// }
// ASSERT_TRUE(found);
//
// // Remove the request
// cta::common::dataStructures::DeleteArchiveRequest dar;
// dar.archiveFileID = archiveFileId;
// dar.requester.group = "group1";
// dar.requester.name = "user1";
// scheduler.deleteArchive("disk_instance", dar);
//
// // Validate that the request is gone.
// found=false;
// for (auto & tp: scheduler.getPendingArchiveJobs()) {
// for (auto & req: tp.second) {
// if (req.archiveFileID == archiveFileId)
// found = true;
// }
// }
// ASSERT_FALSE(found);
//}
TEST_P(SchedulerTest, archive_and_retrieve_new_file) {
using namespace cta;
......
......@@ -2171,64 +2171,6 @@ std::string XrdCtaFile::xCom_retrieve() {
//------------------------------------------------------------------------------
// xCom_deletearchive
//------------------------------------------------------------------------------
// IMPLEMENTATION THAT CALLS THE SCHEDULER
// This version is commented out because it tries to delete the archive ID from
// the object store which can possible take more than 15 seconds.
//std::string XrdCtaFile::xCom_deletearchive() {
// std::stringstream cmdlineOutput;
// std::stringstream help;
// help << m_requestTokens.at(0) << " da/deletearchive --user <user> --group <group> --id <CTA_ArchiveFileID>" << std::endl
// << "\tNote: apply the postfix \":base64\" to long option names whose values are base64 encoded" << std::endl;
// optional<std::string> user = getOptionStringValue("", "--user", true, false);
// optional<std::string> group = getOptionStringValue("", "--group", true, false);
// optional<uint64_t> id = getOptionUint64Value("", "--id", true, false);
// checkOptions(help.str());
// cta::common::dataStructures::UserIdentity originator;
// originator.name=user.value();
// originator.group=group.value();
// cta::common::dataStructures::DeleteArchiveRequest request;
// request.archiveFileID=id.value();
// request.requester=originator;
// const cta::common::dataStructures::ArchiveFile archiveFile = m_scheduler->deleteArchive(m_cliIdentity.username, request);
// std::list<cta::log::Param> params;
// params.push_back(cta::log::Param("USERNAME", m_cliIdentity.username));
// params.push_back(cta::log::Param("HOST", m_cliIdentity.host));
// params.push_back(cta::log::Param("fileId", std::to_string(archiveFile.archiveFileID)));
// params.push_back(cta::log::Param("diskInstance", archiveFile.diskInstance));
// params.push_back(cta::log::Param("diskFileId", archiveFile.diskFileId));
// params.push_back(cta::log::Param("diskFileInfo.path", archiveFile.diskFileInfo.path));
// params.push_back(cta::log::Param("diskFileInfo.owner", archiveFile.diskFileInfo.owner));
// params.push_back(cta::log::Param("diskFileInfo.group", archiveFile.diskFileInfo.group));
// params.push_back(cta::log::Param("diskFileInfo.recoveryBlob", archiveFile.diskFileInfo.recoveryBlob));
// params.push_back(cta::log::Param("fileSize", std::to_string(archiveFile.fileSize)));
// params.push_back(cta::log::Param("checksumType", archiveFile.checksumType));
// params.push_back(cta::log::Param("checksumValue", archiveFile.checksumValue));
// params.push_back(cta::log::Param("creationTime", std::to_string(archiveFile.creationTime)));
// params.push_back(cta::log::Param("reconciliationTime", std::to_string(archiveFile.reconciliationTime)));
// params.push_back(cta::log::Param("storageClass", archiveFile.storageClass));
// for(auto it=archiveFile.tapeFiles.begin(); it!=archiveFile.tapeFiles.end(); it++) {
// std::stringstream tapeCopyLogStream;
// tapeCopyLogStream << "copy number: " << it->first
// << " vid: " << it->second.vid
// << " fSeq: " << it->second.fSeq
// << " blockId: " << it->second.blockId
// << " creationTime: " << it->second.creationTime
// << " compressedSize: " << it->second.compressedSize
// << " checksumType: " << it->second.checksumType //this shouldn't be here: repeated field
// << " checksumValue: " << it->second.checksumValue //this shouldn't be here: repeated field
// << " copyNb: " << it->second.copyNb; //this shouldn't be here: repeated field
// params.push_back(cta::log::Param("TAPE FILE", tapeCopyLogStream.str()));
// }
// m_log(log::INFO, "Archive File Deleted", params);
// return cmdlineOutput.str();
//}
//------------------------------------------------------------------------------
// xCom_deletearchive
//------------------------------------------------------------------------------
// THIS IS A TEMPORARY SOLUTION
// TODO - Decide whther or not xCom_deletearchive() needs to call the scheduler
// and then update this code accordingly.
std::string XrdCtaFile::xCom_deletearchive() {
std::stringstream help;
help << m_requestTokens.at(0) << " da/deletearchive --user <user> --group <group> --id <CTA_ArchiveFileID>" << std::endl
......@@ -2243,50 +2185,8 @@ std::string XrdCtaFile::xCom_deletearchive() {
cta::common::dataStructures::DeleteArchiveRequest request;
request.archiveFileID=id.value();
request.requester=originator;
try {
const std::string &instanceName = m_cliIdentity.username;
const cta::common::dataStructures::ArchiveFile archiveFile =
m_catalogue->deleteArchiveFile(instanceName, request.archiveFileID);
std::list<cta::log::Param> params;
params.push_back(cta::log::Param("USERNAME", m_cliIdentity.username));
params.push_back(cta::log::Param("HOST", m_cliIdentity.host));
params.push_back(cta::log::Param("fileId", std::to_string(archiveFile.archiveFileID)));
params.push_back(cta::log::Param("diskInstance", archiveFile.diskInstance));
params.push_back(cta::log::Param("diskFileId", archiveFile.diskFileId));
params.push_back(cta::log::Param("diskFileInfo.path", archiveFile.diskFileInfo.path));
params.push_back(cta::log::Param("diskFileInfo.owner", archiveFile.diskFileInfo.owner));
params.push_back(cta::log::Param("diskFileInfo.group", archiveFile.diskFileInfo.group));
params.push_back(cta::log::Param("diskFileInfo.recoveryBlob", archiveFile.diskFileInfo.recoveryBlob));
params.push_back(cta::log::Param("fileSize", std::to_string(archiveFile.fileSize)));
params.push_back(cta::log::Param("checksumType", archiveFile.checksumType));
params.push_back(cta::log::Param("checksumValue", archiveFile.checksumValue));
params.push_back(cta::log::Param("creationTime", std::to_string(archiveFile.creationTime)));
params.push_back(cta::log::Param("reconciliationTime", std::to_string(archiveFile.reconciliationTime)));
params.push_back(cta::log::Param("storageClass", archiveFile.storageClass));
for(auto it=archiveFile.tapeFiles.begin(); it!=archiveFile.tapeFiles.end(); it++) {
std::stringstream tapeCopyLogStream;
tapeCopyLogStream << "copy number: " << it->first
<< " vid: " << it->second.vid
<< " fSeq: " << it->second.fSeq
<< " blockId: " << it->second.blockId
<< " creationTime: " << it->second.creationTime
<< " compressedSize: " << it->second.compressedSize