Commit 9781ccbd authored by Eric Cano's avatar Eric Cano
Browse files

Added needed tapePool field to TapeForWriting.

parent 2bf5c414
......@@ -53,6 +53,11 @@ struct TapeForWriting {
* The volume identifier of the tape.
*/
std::string vid;
/**
* The name of the tape pool
*/
std::string tapePool;
/**
* The file sequence number of the last file successfully written to the tape.
......
......@@ -282,15 +282,12 @@ std::list<cta::common::dataStructures::DriveState> cta::Scheduler::getDriveState
// getNextMount
//------------------------------------------------------------------------------
std::unique_ptr<cta::TapeMount> cta::Scheduler::getNextMount(const std::string &logicalLibraryName, const std::string &driveName) {
/*
// In order to decide the next mount to do, we have to take a global lock on
// the scheduling, retrieve a list of all running mounts, queues sizes for
// tapes and tape pools, filter the tapes which are actually accessible to
// this drive (by library and dedication), order the candidates by priority
// below threshold, and pick one at a time. In addition, for archives, we
// might not find a suitable tape (by library and dedication). In such a case,
// we should find out if no tape at all is available, and log an error if
// so.
// tapes and tape pools, order the candidates by priority
// below threshold, and pick one at a time, we then attempt to get a tape
// from the catalogue (for the archive mounts), and walk the list until we
// mount or find nothing to do.
// We then skip to the next candidate, until we find a suitable one and
// return the mount, or exhaust all of them an
// Many steps for this logic are not specific for the database and are hence
......@@ -336,17 +333,17 @@ std::unique_ptr<cta::TapeMount> cta::Scheduler::getNextMount(const std::string &
existingMounts = 0;
}
bool mountPassesACriteria = false;
if (m->bytesQueued / (1 + existingMounts) >= m->mountCriteria.maxBytesQueued)
if (m->bytesQueued / (1 + existingMounts) >= m_minBytesToWarrantAMount)
mountPassesACriteria = true;
if (m->filesQueued / (1 + existingMounts) >= m->mountCriteria.maxFilesQueued)
if (m->filesQueued / (1 + existingMounts) >= m_minFilesToWarrantAMount)
mountPassesACriteria = true;
if (!existingMounts && ((time(NULL) - m->oldestJobStartTime) > (int64_t)m->mountCriteria.maxAge))
if (!existingMounts && ((time(NULL) - m->oldestJobStartTime) > m->minArchiveRequestAge))
mountPassesACriteria = true;
if (!mountPassesACriteria || existingMounts >= m->mountCriteria.quota) {
if (!mountPassesACriteria || existingMounts >= m->maxDrivesAllowed) {
m = mountInfo->potentialMounts.erase(m);
} else {
// populate the mount with a weight
m->ratioOfMountQuotaUsed = 1.0L * existingMounts / m->mountCriteria.quota;
m->ratioOfMountQuotaUsed = 1.0L * existingMounts / m->maxDrivesAllowed;
m++;
}
}
......@@ -364,7 +361,7 @@ std::unique_ptr<cta::TapeMount> cta::Scheduler::getNextMount(const std::string &
if (m->type==cta::MountType::ARCHIVE) {
// We need to find a tape for archiving. It should be both in the right
// tape pool and in the drive's logical library
auto tapesList = m_db.getTapes();
auto tapesList = m_catalogue.getTapesForWriting(logicalLibraryName);
// The first tape matching will go for a prototype.
// TODO: improve to reuse already partially written tapes
for (auto t=tapesList.begin(); t!=tapesList.end(); t++) {
......
......@@ -279,7 +279,7 @@ public:
std::string tapePool; /**< The name of the tape pool for both archive and retrieve */
uint64_t priority; /**< The priority for the mount, defined as the highest priority of all queued jobs */
uint64_t maxDrivesAllowed; /**< The maximum number of drives allowed for this tape pool, defined as the highest value amongst jobs */
uint64_t minArchiveRequestAge; /**< The maximum amount of time to wait before forcing a mount in the absence of enough data. Defined as the smallest value amongst jobs.*/
time_t minArchiveRequestAge; /**< The maximum amount of time to wait before forcing a mount in the absence of enough data. Defined as the smallest value amongst jobs.*/
uint64_t filesQueued; /**< The number of files queued for this queue */
uint64_t bytesQueued; /**< The amount of data currently queued */
time_t oldestJobStartTime; /**< Creation time of oldest request */
......
Supports Markdown
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