Commit 4fd58382 authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#777 Minimize mounts for dual copy tape pool recalls

A temporary fix that tries to force recalls to use the
tape copies with the lowest tape copy numbers.
parent 1d31d166
...@@ -193,6 +193,42 @@ std::string Scheduler::queueRetrieve( ...@@ -193,6 +193,42 @@ std::string Scheduler::queueRetrieve(
common::dataStructures::RetrieveFileQueueCriteria queueCriteria; common::dataStructures::RetrieveFileQueueCriteria queueCriteria;
queueCriteria = m_catalogue.prepareToRetrieveFile(instanceName, request.archiveFileID, request.requester, request.activity, lc); queueCriteria = m_catalogue.prepareToRetrieveFile(instanceName, request.archiveFileID, request.requester, request.activity, lc);
queueCriteria.archiveFile.diskFileInfo = request.diskFileInfo; queueCriteria.archiveFile.diskFileInfo = request.diskFileInfo;
// The following if statement is a temporary fix for the following CTA issue:
//
// cta/CTA#777 Minimize mounts for dual copy tape pool recalls
//
// The code tries to force a recall to use the tape copy with the lowest
// tape copy number. On the one hand this increases wear and tear on tapes
// containing files with lower tape copy numbers but on the other hand it
// reduces the number of overall number tape mounts in situations where files
// with multiple tape copies are being recalled.
if (1 < queueCriteria.archiveFile.tapeFiles.size()) {
uint8_t lowestCopyNb = std::numeric_limits<uint8_t>::max();
std::map<uint8_t, common::dataStructures::TapeFile> copyNbToTapeFile;
for (auto tapeFile: queueCriteria.archiveFile.tapeFiles) {
if (copyNbToTapeFile.end() == copyNbToTapeFile.find(tapeFile.copyNb)) {
if (tapeFile.copyNb < lowestCopyNb) {
lowestCopyNb = tapeFile.copyNb;
}
copyNbToTapeFile[tapeFile.copyNb] = tapeFile;
} else {
std::ostringstream msg;
msg << __FUNCTION__ << ": Found archive file with duplicate tape copy number: vid=" << tapeFile.vid <<
" copyNb=" << (uint32_t)tapeFile.copyNb;
lc.log(log::WARNING, msg.str());
}
}
if (!copyNbToTapeFile.empty()) {
const auto lowestCopyNbTapeFile = copyNbToTapeFile.find(lowestCopyNb);
if (copyNbToTapeFile.end() != lowestCopyNbTapeFile) {
queueCriteria.archiveFile.tapeFiles.clear();
queueCriteria.archiveFile.tapeFiles.push_back(lowestCopyNbTapeFile->second);
}
}
}
auto diskSystemList = m_catalogue.getAllDiskSystems(); auto diskSystemList = m_catalogue.getAllDiskSystems();
auto catalogueTime = t.secs(cta::utils::Timer::resetCounter); auto catalogueTime = t.secs(cta::utils::Timer::resetCounter);
// By default, the scheduler makes its decision based on all available vids. But if a vid is specified in the protobuf, // By default, the scheduler makes its decision based on all available vids. But if a vid is specified in the protobuf,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment