Commit 8431b8dc authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[repack] Removed the stopping of the expansion of the repack request

parent 00db5818
......@@ -2651,7 +2651,7 @@ uint64_t OStoreDB::RepackRequest::addSubrequestsAndUpdateStats(std::list<Subrequ
if (tc.vid == repackInfo.vid) {
try {
// Try to select the repack VID from a one-vid list.
Helpers::selectBestRetrieveQueue({repackInfo.vid}, m_oStoreDB.m_catalogue, m_oStoreDB.m_objectStore,repackInfo.forceDisabledTape);
Helpers::selectBestRetrieveQueue({repackInfo.vid}, m_oStoreDB.m_catalogue, m_oStoreDB.m_objectStore,forceDisabledTape);
bestVid = repackInfo.vid;
activeCopyNumber = tc.copyNb;
} catch (Helpers::NoTapeAvailableForRetrieve &) {}
......@@ -2672,10 +2672,10 @@ uint64_t OStoreDB::RepackRequest::addSubrequestsAndUpdateStats(std::list<Subrequ
failedCreationStats.bytes += rsr.archiveFile.fileSize;
log::ScopedParamContainer params(lc);
params.add("fileId", rsr.archiveFile.archiveFileID)
.add("forceDisabledTape",repackInfo.forceDisabledTape)
.add("wasRepackSubmittedWithForceDisabledTape",forceDisabledTape)
.add("repackVid", repackInfo.vid);
lc.log(log::ERR,
"In OStoreDB::RepackRequest::addSubrequests(): could not queue a retrieve subrequest. Subrequest failed.");
"In OStoreDB::RepackRequest::addSubrequests(): could not queue a retrieve subrequest. Subrequest failed. Maybe the tape to repack is disabled ?");
continue;
}
}
......@@ -2692,7 +2692,7 @@ uint64_t OStoreDB::RepackRequest::addSubrequestsAndUpdateStats(std::list<Subrequ
log::ScopedParamContainer params(lc);
params.add("fileId", rsr.archiveFile.archiveFileID)
.add("repackVid", repackInfo.vid)
.add("bestVid", bestVid);
.add("chosenVid", bestVid);
lc.log(log::ERR,
"In OStoreDB::RepackRequest::addSubrequests(): could not find the copyNb for the chosen VID. Subrequest failed.");
continue;
......
This diff is collapsed.
......@@ -274,13 +274,6 @@ public:
/*============== Actual mount scheduling and queue status reporting ========*/
private:
const size_t c_defaultMaxNbFilesForRepack = 500;
/**
* This time is used to limitate the time an expansion of a RepackRequest will take
* If the RepackRequest has not finished its expansion before this time limit,
* it will be requeued in the RepackQueueToExpand queue.
*/
double m_repackRequestExpansionTimeLimit = 30;
typedef std::pair<std::string, common::dataStructures::MountType> TapePoolMountPair;
struct MountCounts {
......
......@@ -2677,133 +2677,6 @@ TEST_P(SchedulerTest, expandRepackRequestArchiveFailed) {
}
}
TEST_P(SchedulerTest, expandRepackRequestExpansionTimeLimitReached) {
using namespace cta;
using namespace cta::objectstore;
unitTests::TempDirectory tempDirectory;
auto &catalogue = getCatalogue();
auto &scheduler = getScheduler();
//Set the expansion time limit to 0
scheduler.setRepackRequestExpansionTimeLimit(0.0);
auto &schedulerDB = getSchedulerDB();
cta::objectstore::Backend& backend = schedulerDB.getBackend();
setupDefaultCatalogue();
#ifdef STDOUT_LOGGING
log::StdoutLogger dl("dummy", "unitTest");
#else
log::DummyLogger dl("", "");
#endif
log::LogContext lc(dl);
//Create an agent to represent this test process
cta::objectstore::AgentReference agentReference("expandRepackRequestTest", dl);
cta::objectstore::Agent agent(agentReference.getAgentAddress(), backend);
agent.initialize();
agent.setTimeout_us(0);
agent.insertAndRegisterSelf(lc);
const bool disabledValue = false;
const bool fullValue = true;
const bool readOnlyValue = false;
const std::string comment = "Create tape";
cta::common::dataStructures::SecurityIdentity admin;
admin.username = "admin_user_name";
admin.host = "admin_host";
//Create a logical library in the catalogue
const bool logicalLibraryIsDisabled = false;
catalogue.createLogicalLibrary(admin, s_libraryName, logicalLibraryIsDisabled, "Create logical library");
std::ostringstream ossVid;
ossVid << s_vid << "_" << 1;
std::string vid = ossVid.str();
{
catalogue::CreateTapeAttributes tape;
tape.vid = vid;
tape.mediaType = s_mediaType;
tape.vendor = s_vendor;
tape.logicalLibraryName = s_libraryName;
tape.tapePoolName = s_tapePoolName;
tape.full = fullValue;
tape.disabled = disabledValue;
tape.readOnly = readOnlyValue;
tape.comment = comment;
catalogue.createTape(s_adminOnAdminHost, tape);
}
//Create a storage class in the catalogue
common::dataStructures::StorageClass storageClass;
storageClass.name = s_storageClassName;
storageClass.nbCopies = 2;
storageClass.comment = "Create storage class";
const std::string tapeDrive = "tape_drive";
const uint64_t nbArchiveFilesPerTape = 10;
const uint64_t archiveFileSize = 2 * 1000 * 1000 * 1000;
//Simulate the writing of 10 files in 1 tape in the catalogue
std::set<catalogue::TapeItemWrittenPointer> tapeFilesWrittenCopy1;
{
uint64_t archiveFileId = 1;
std::string currentVid = vid;
for(uint64_t j = 1; j <= nbArchiveFilesPerTape; ++j) {
std::ostringstream diskFileId;
diskFileId << (12345677 + archiveFileId);
std::ostringstream diskFilePath;
diskFilePath << "/public_dir/public_file_"<<1<<"_"<< j;
auto fileWrittenUP=cta::make_unique<cta::catalogue::TapeFileWritten>();
auto & fileWritten = *fileWrittenUP;
fileWritten.archiveFileId = archiveFileId++;
fileWritten.diskInstance = s_diskInstance;
fileWritten.diskFileId = diskFileId.str();
fileWritten.diskFileOwnerUid = PUBLIC_OWNER_UID;
fileWritten.diskFileGid = PUBLIC_GID;
fileWritten.size = archiveFileSize;
fileWritten.checksumBlob.insert(cta::checksum::ADLER32,"1234");
fileWritten.storageClassName = s_storageClassName;
fileWritten.vid = currentVid;
fileWritten.fSeq = j;
fileWritten.blockId = j * 100;
fileWritten.size = archiveFileSize;
fileWritten.copyNb = 1;
fileWritten.tapeDrive = tapeDrive;
tapeFilesWrittenCopy1.emplace(fileWrittenUP.release());
}
//update the DB tape
catalogue.filesWrittenToTape(tapeFilesWrittenCopy1);
tapeFilesWrittenCopy1.clear();
}
//Test the expanding requeue the Repack after the creation of
//one retrieve request
scheduler.waitSchedulerDbSubthreadsComplete();
{
cta::SchedulerDatabase::QueueRepackRequest qrr(vid,"file://"+tempDirectory.path(),common::dataStructures::RepackInfo::Type::MoveOnly,
common::dataStructures::MountPolicy::s_defaultMountPolicyForRepack,s_defaultRepackDisabledTapeFlag,s_defaultRepackNoRecall);
scheduler.queueRepack(admin,qrr,lc);
scheduler.waitSchedulerDbSubthreadsComplete();
log::TimingList tl;
utils::Timer t;
scheduler.promoteRepackRequestsToToExpand(lc);
scheduler.waitSchedulerDbSubthreadsComplete();
auto repackRequestToExpand = scheduler.getNextRepackRequestToExpand();
scheduler.expandRepackRequest(repackRequestToExpand,tl,t,lc);
scheduler.waitSchedulerDbSubthreadsComplete();
ASSERT_EQ(vid,repackRequestToExpand->getRepackInfo().vid);
//Because the timer is set to 0, the Repack Request should
//have been requeued in the ToExpand queue.
//We check that by the getNextRepackRequestToExpand method
repackRequestToExpand = scheduler.getNextRepackRequestToExpand();
ASSERT_NE(nullptr,repackRequestToExpand);
ASSERT_EQ(vid,repackRequestToExpand->getRepackInfo().vid);
}
}
TEST_P(SchedulerTest, expandRepackRequestDisabledTape) {
using namespace cta;
using namespace cta::objectstore;
......
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