Commit 0130bb1f authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[repack] Implemented repack add --no-recall feature

parent 49ffcd7a
# v3.1-3
## Summary
### Features
- The --no-recall flag can be passed to cta-admin repack add command:
- The repack request will NOT trigger any retrieve mount. Only the files that are in the repack buffer will be considered for archival.
### Modification
### Bug fixes
# v3.1-2
## Summary
### Moficiation
### Modification
- Added database upgrade/changelog script oracle/3.0to3.1.sql
......
......@@ -266,7 +266,8 @@ const std::map<std::string, OptionBoolean::Key> boolOptions = {
{ "--justretrieve", OptionBoolean::JUSTRETRIEVE },
{ "--log", OptionBoolean::SHOW_LOG_ENTRIES },
{ "--lookupnamespace", OptionBoolean::LOOKUP_NAMESPACE },
{ "--summary", OptionBoolean::SUMMARY }
{ "--summary", OptionBoolean::SUMMARY },
{ "--no-recall", OptionBoolean::NO_RECALL}
};
......@@ -378,7 +379,8 @@ const std::map<AdminCmd::Cmd, CmdHelp> cmdHelp = {
" By default, CTA will migrate AND add new (or missing) copies (as defined by the storage class) of the files located on the tape to repack.\n"
" * The --mountpolicy option allows to give a specific mount policy that will be applied to the repack subrequests (retrieve and archive requests).\n"
" By default, a hardcoded mount policy is applied (every request priorities and minimum request ages = 1).\n"
" * If the --disabledtape flag is set, the tape to repack will be mounted for retrieval even if it is disabled."
" * If the --disabledtape flag is set, the tape to repack will be mounted for retrieval even if it is disabled.\n"
" * If the --no-recall flag is set, no retrieve mount will be triggered and only the files that are located in the buffer will be considered for archival."
"\n\n"
}},
{ AdminCmd::CMD_REQUESTERMOUNTRULE, { "requestermountrule", "rmr", { "add", "ch", "rm", "ls" } }},
......@@ -501,6 +503,7 @@ const Option opt_refresh_interval { Option::OPT_UINT, "--refreshinterval",
const Option opt_targeted_free_space { Option::OPT_UINT, "--targetedfreespace", "-f", " <targeted_free_space>" };
const Option opt_sleep_time { Option::OPT_UINT, "--sleeptime", "-s", " <sleep time in s>" };
const Option opt_reason { Option::OPT_STR, "--reason", "-r", " <reason_status_change>" };
const Option opt_no_recall { Option::OPT_FLAG, "--no-recall", "-nr", "" };
/*!
* Map valid options to commands
......@@ -575,7 +578,7 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = {
{{ AdminCmd::CMD_MOUNTPOLICY, AdminCmd::SUBCMD_LS }, { }},
/*----------------------------------------------------------------------------------------------------*/
{{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_ADD },
{ opt_vid.optional(), opt_vidfile.optional(), opt_bufferurl.optional(), opt_justmove.optional(), opt_justaddcopies.optional(), opt_mountpolicy, opt_disabled_tape.optional() }},
{ opt_vid.optional(), opt_vidfile.optional(), opt_bufferurl.optional(), opt_justmove.optional(), opt_justaddcopies.optional(), opt_mountpolicy, opt_disabled_tape.optional(), opt_no_recall.optional() }},
{{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_RM }, { opt_vid }},
{{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_LS }, { opt_vid.optional() }},
{{ AdminCmd::CMD_REPACK, AdminCmd::SUBCMD_ERR }, { opt_vid }},
......
......@@ -70,6 +70,7 @@ struct RepackInfo {
uint64_t archivedFiles;
bool isExpandFinished;
bool forceDisabledTape;
bool noRecall;
RepackDestinationInfo::List destinationInfos;
// std::string tag;
// uint64_t totalFiles;
......
......@@ -975,5 +975,14 @@ void appendParameterXRootFileURL(std::string &fileURL, const std::string &parame
}
}
std::string removePrefix(const std::string& input, char prefixChar){
size_t position = input.find_first_not_of(prefixChar);
if(position == std::string::npos){
return input;
} else {
return input.substr(position,input.size());
}
}
} // namespace utils
} // namespace cta
......@@ -462,6 +462,15 @@ namespace utils {
return ret;
}
/**
* Allows to remove the first c chars from the beginning of a string
* Example : removePrefix(aaaaaabcdef,'a') -> bcdef
* @param input the string from which we will remove the chars c from it
* @param prefixChar the character that we want to remove from the beginning
* @return a new string with the prefix.
*/
std::string removePrefix(const std::string & input, char prefixChar);
} // namespace utils
} // namespace cta
......@@ -24,6 +24,7 @@ reportDirectory : the directory to generate the report of the repack test (defau
-m : Launch a repack just move workflow
-d : Force a repack on a disabled tape (adds --disabled to the repack add command)
-p : enable backpressure test
-u : recall only option flag
EOF
exit 1
}
......@@ -47,7 +48,7 @@ then
fi;
DISABLED_TAPE_FLAG=""
while getopts "v:e:b:t:r:n:amdp" o; do
while getopts "v:e:b:t:r:n:amdpu" o; do
case "${o}" in
v)
VID_TO_REPACK=${OPTARG}
......@@ -79,6 +80,9 @@ while getopts "v:e:b:t:r:n:amdp" o; do
n)
MOUNT_POLICY_NAME=${OPTARG}
;;
u)
NO_RECALL=1
;;
*)
usage
;;
......@@ -139,7 +143,12 @@ fi
echo "Launching repack request for VID ${VID_TO_REPACK}, bufferURL = ${FULL_REPACK_BUFFER_URL}"
admin_cta repack add --mountpolicy ${MOUNT_POLICY_NAME} --vid ${VID_TO_REPACK} ${REPACK_OPTION} --bufferurl ${FULL_REPACK_BUFFER_URL} ${DISABLED_TAPE_FLAG}
NO_RECALL_FLAG=""
if [ ! -z $NO_RECALL ]; then
NO_RECALL_FLAG="-nr"
fi
admin_cta repack add --mountpolicy ${MOUNT_POLICY_NAME} --vid ${VID_TO_REPACK} ${REPACK_OPTION} --bufferurl ${FULL_REPACK_BUFFER_URL} ${DISABLED_TAPE_FLAG} ${NO_RECALL_FLAG}
if [ ! -z $BACKPRESSURE_TEST ]; then
echo "Backpressure test: waiting to see a report of sleeping retrieve queue."
......
......@@ -467,6 +467,107 @@ repackTapeRepair() {
echo "*******************************************************"
}
repackTapeRepairNoRecall() {
echo
echo "*******************************************************"
echo "STEP $1. Testing Repack \"Tape Repair\" NO RECALL workflow with the --no-recall"
echo "*******************************************************"
VID_TO_REPACK=$(getFirstVidContainingFiles)
if [ "$VID_TO_REPACK" == "null" ]
then
echo "No vid found to repack"
exit 1
fi
echo "Getting files to inject into the repack buffer directory"
tfls=`kubectl -n ${NAMESPACE} exec ctacli -- cta-admin --json tapefile ls --vid ${VID_TO_REPACK}`
nbFilesOnTape=`echo $tfls | jq length`
nbFileToInject=10
if [[ $nbFileToInject != 0 ]]
then
echo "Will inject $nbFileToInject files into the repack buffer directory"
bufferDirectory=${REPACK_BUFFER_URL}/${VID_TO_REPACK}
echo "Creating buffer directory in \"$bufferDirectory\""
kubectl -n ${NAMESPACE} exec ctaeos -- eos mkdir $bufferDirectory
kubectl -n ${NAMESPACE} exec ctaeos -- eos chmod 1777 $bufferDirectory
echo "Retrieving files from the tape"
allPid=()
pathOfFilesToInject=()
diskIds=()
filesIndices=()
# Prepare array of indices to pick from the tfls output
for i in $(seq 0 $(( nbFileToInject - 1 )) )
do
filesIndices[$i]=$(( i + 1 ))
done
for i in $(seq 0 $(( nbFileToInject - 1 )) )
do
diskId=`echo $tfls | jq -r ". [${filesIndices[$i]}] | .df.diskId"` || break
diskIds[$i]=$diskId
pathFileToInject=`kubectl -n ${NAMESPACE} exec ctaeos -- eos fileinfo fid:$diskId --path | cut -d":" -f2 | tr -d " "`
pathOfFilesToInject[$i]=$pathFileToInject
done
kubectl -n ${NAMESPACE} exec client -- bash /root/client_prepare_file.sh `for file in ${pathOfFilesToInject[@]}; do echo -n "-f $file "; done`
echo "Copying the retrieved files into the repack buffer $bufferDirectory"
for i in $(seq 0 $(( nbFileToInject - 1)) )
do
fseqFile=`echo $tfls | jq -r ". [] | select(.df.diskId == \"${diskIds[$i]}\") | .tf.fSeq"` || break
kubectl -n ${NAMESPACE} exec ctaeos -- eos cp ${pathOfFilesToInject[$i]} $bufferDirectory/`printf "%9d\n" $fseqFile | tr ' ' 0`
done
echo "Launching a repack request on the vid ${VID_TO_REPACK}"
kubectl -n ${NAMESPACE} exec client -- bash /root/repack_systemtest.sh -v ${VID_TO_REPACK} -b ${REPACK_BUFFER_URL} -m -r ${BASE_REPORT_DIRECTORY}/Step$1-RepackTapeRepairNoRecall -n ctasystest -u || exit 1
repackLsResult=`kubectl -n ${NAMESPACE} exec ctacli -- cta-admin --json repack ls --vid ${VID_TO_REPACK} | jq -r ". [0]"`
userProvidedFiles=`echo $repackLsResult | jq -r ".userProvidedFiles"`
archivedFiles=`echo $repackLsResult | jq -r ".archivedFiles"`
retrievedFiles=`echo $repackLsResult | jq -r ".retrievedFiles"`
totalFilesToRetrieve=`echo $repackLsResult | jq -r ".totalFilesToRetrieve"`
totalFilesToArchive=`echo $repackLsResult | jq -r ".totalFilesToArchive"`
if [[ $totalFilesToRetrieve != $(( $totalFilesToArchive - $userProvidedFiles )) ]]
then
echo "totalFilesToRetrieve ($totalFilesToRetrieve) != totalFilesToArchive ($totalFilesToArchive) - userProvidedFiles ($userProvidedFiles), test FAILED"
exit 1
else
echo "totalFilesToRetrieve ($totalFilesToRetrieve) == totalFilesToArchive ($totalFilesToArchive) - userProvidedFiles ($userProvidedFiles), OK"
fi
if [[ $retrievedFiles != $totalFilesToRetrieve ]]
then
echo "retrievedFiles ($retrievedFiles) != totalFilesToRetrieve ($totalFilesToRetrieve) test FAILED"
exit 1
else
echo "retrievedFiles ($retrievedFiles) == totalFilesToRetrieve ($totalFilesToRetrieve), OK"
fi
if [[ $archivedFiles != $totalFilesToArchive ]]
then
echo "archivedFiles ($archivedFiles) != totalFilesToArchive ($totalFilesToArchive), test FAILED"
exit 1
else
echo "archivedFiles ($archivedFiles) == totalFilesToArchive ($totalFilesToArchive), OK"
fi
else
echo "No file to inject, test not OK"
exit 1
fi
echo
echo "*******************************************************"
echo "STEP $1. Testing Repack \"Tape Repair\" workflow NO RECALL TEST OK"
echo "*******************************************************"
}
#Execution of each tests
roundTripRepack 1
repackDisableTape 2
......@@ -475,4 +576,5 @@ repackJustMove 3
repackTapeRepair 4
repackJustAddCopies 5
repackCancellation 6
# repackMoveAndAddCopies 7
\ No newline at end of file
# repackMoveAndAddCopies 7
repackTapeRepairNoRecall 7
\ No newline at end of file
......@@ -208,37 +208,37 @@ namespace cta {
};
class Directory {
public:
/**
* Creates a directory
* @throws an exception if the directory could not have been created
*/
virtual void mkdir() = 0;
/**
* Check if the directory exist
* @return true if the directory exists, false otherwise
*/
virtual bool exist() = 0;
/**
* Return all the names of the files present in the directory
* @return
*/
virtual std::set<std::string> getFilesName() = 0;
/**
* Remove the directory located at this->m_URL
*/
virtual void rmdir() = 0;
virtual ~Directory() throw() {}
protected:
/**
* Storage for the URL
*/
std::string m_URL;
};
} //end of namespace disk
class Directory {
public:
/**
* Creates a directory
* @throws an exception if the directory could not have been created
*/
virtual void mkdir() = 0;
/**
* Check if the directory exist
* @return true if the directory exists, false otherwise
*/
virtual bool exist() = 0;
/**
* Return all the names of the files present in the directory
* @return
*/
virtual std::set<std::string> getFilesName() = 0;
/**
* Remove the directory located at this->m_URL
*/
virtual void rmdir() = 0;
virtual ~Directory() throw() {}
protected:
/**
* Storage for the URL
*/
std::string m_URL;
};
} //end of namespace disk
} //end of namespace cta
......@@ -79,6 +79,7 @@ void RepackRequest::initialize() {
m_payload.set_is_expand_finished(false);
m_payload.set_is_expand_started(false);
m_payload.set_force_disabled_tape(false);
m_payload.set_no_recall(false);
m_payload.set_is_complete(false);
// This object is good to go (to storage)
m_payloadInterpreted = true;
......@@ -148,6 +149,7 @@ common::dataStructures::RepackInfo RepackRequest::getInfo() {
ret.userProvidedFiles = m_payload.userprovidedfiles();
ret.isExpandFinished = m_payload.is_expand_finished();
ret.forceDisabledTape = m_payload.force_disabled_tape();
ret.noRecall = m_payload.no_recall();
for(auto & rdi: m_payload.destination_infos()){
RepackInfo::RepackDestinationInfo rdiToInsert;
rdiToInsert.vid = rdi.vid();
......@@ -272,6 +274,17 @@ bool RepackRequest::getForceDisabledTape() {
checkPayloadReadable();
return m_payload.force_disabled_tape();
}
void RepackRequest::setNoRecall(const bool noRecall) {
checkPayloadWritable();
m_payload.set_no_recall(noRecall);
}
bool RepackRequest::getNoRecall(){
checkPayloadReadable();
return m_payload.no_recall();
}
void RepackRequest::setStatus(){
checkPayloadWritable();
checkPayloadReadable();
......@@ -730,6 +743,7 @@ RepackRequest::AsyncOwnerAndStatusUpdater* RepackRequest::asyncUpdateOwnerAndSta
retRef.m_repackInfo.vid = payload.vid();
retRef.m_repackInfo.repackBufferBaseURL = payload.buffer_url();
retRef.m_repackInfo.forceDisabledTape = payload.force_disabled_tape();
retRef.m_repackInfo.noRecall = payload.no_recall();
if (payload.move_mode()) {
if (payload.add_copies_mode()) {
retRef.m_repackInfo.type = RepackInfo::Type::MoveAndAddCopies;
......
......@@ -63,6 +63,15 @@ public:
void setForceDisabledTape(const bool disabledTape);
bool getForceDisabledTape();
/**
* Set the flag noRecall to only inject files that are in the buffer. This will prevent
* to retrieve the files from the repacked tape.
* @param noRecall if true, the repack expansion will only look at what is on the buffer
* if false, the expansion will create Retrieve subrequests for files that are not in the buffer
*/
void setNoRecall(const bool noRecall);
bool getNoRecall();
/**
* Automatically set the new status of the Repack Request
* regarding multiple parameters
......
......@@ -628,6 +628,7 @@ message RepackRequest {
required MountPolicy mount_policy = 11563;
required bool force_disabled_tape = 11564;
required bool is_complete = 11565;
required bool no_recall = 11566;
repeated RepackSubRequestPointer subrequests = 11570;
repeated RepackDestinationInfo destination_infos = 11571;
}
......
......@@ -1576,8 +1576,12 @@ OStoreDB::RetrieveQueueItor_t* OStoreDB::getRetrieveJobItorPtr(const std::string
//------------------------------------------------------------------------------
// OStoreDB::queueRepack()
//------------------------------------------------------------------------------
void OStoreDB::queueRepack(const std::string& vid, const std::string& bufferURL,
common::dataStructures::RepackInfo::Type repackType, const common::dataStructures::MountPolicy& mountPolicy, const bool forceDisabledTape,log::LogContext & lc) {
void OStoreDB::queueRepack(const SchedulerDatabase::QueueRepackRequest & repackRequest,log::LogContext & lc) {
std::string vid = repackRequest.m_vid;
common::dataStructures::RepackInfo::Type repackType = repackRequest.m_repackType;
std::string bufferURL = repackRequest.m_repackBufferURL;
common::dataStructures::MountPolicy mountPolicy = repackRequest.m_mountPolicy;
bool forceDisabledTape = repackRequest.m_forceDisabledTape;
// Prepare the repack request object in memory.
assertAgentAddressSet();
cta::utils::Timer t;
......@@ -1590,6 +1594,7 @@ void OStoreDB::queueRepack(const std::string& vid, const std::string& bufferURL,
rr->setBufferURL(bufferURL);
rr->setMountPolicy(mountPolicy);
rr->setForceDisabledTape(forceDisabledTape);
rr->setNoRecall(repackRequest.m_noRecall);
// Try to reference the object in the index (will fail if there is already a request with this VID.
try {
Helpers::registerRepackRequestToIndex(vid, rr->getAddressIfSet(), *m_agentReference, m_objectStore, lc);
......@@ -1813,6 +1818,7 @@ std::unique_ptr<SchedulerDatabase::RepackRequest> OStoreDB::getNextRepackJobToEx
ret->repackInfo.status = repackInfo.status;
ret->repackInfo.repackBufferBaseURL = repackInfo.repackBufferBaseURL;
ret->repackInfo.forceDisabledTape = repackInfo.forceDisabledTape;
ret->repackInfo.noRecall = repackInfo.noRecall;
return std::move(ret);
}
}
......
......@@ -384,8 +384,7 @@ public:
JobsFailedSummary getRetrieveJobsFailedSummary(log::LogContext &logContext) override;
/* === Repack requests handling =========================================== */
void queueRepack(const std::string& vid, const std::string& bufferURL,
common::dataStructures::RepackInfo::Type repackType, const common::dataStructures::MountPolicy &mountPolicy, const bool forceDisabledTape, log::LogContext &logContext) override;
void queueRepack(const SchedulerDatabase::QueueRepackRequest & repackRequest, log::LogContext &logContext) override;
std::list<common::dataStructures::RepackInfo> getRepackInfo() override;
common::dataStructures::RepackInfo getRepackInfo(const std::string& vid) override;
......
......@@ -229,8 +229,8 @@ public:
m_OStoreDB.cancelRetrieve(instanceName, rqst, lc);
}
void queueRepack(const std::string& vid, const std::string& bufferURL, common::dataStructures::RepackInfo::Type repackType, const common::dataStructures::MountPolicy &mountPolicy, const bool forceDisabledTape, log::LogContext& lc) override {
m_OStoreDB.queueRepack(vid, bufferURL, repackType, mountPolicy, forceDisabledTape, lc);
void queueRepack(const SchedulerDatabase::QueueRepackRequest & repackRequest, log::LogContext& lc) override {
m_OStoreDB.queueRepack(repackRequest, lc);
}
std::list<common::dataStructures::RepackInfo> getRepackInfo() override {
......
......@@ -321,21 +321,24 @@ void Scheduler::checkTapeFullBeforeRepack(std::string vid){
//------------------------------------------------------------------------------
// repack
//------------------------------------------------------------------------------
void Scheduler::queueRepack(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid,
const std::string & bufferURL, const common::dataStructures::RepackInfo::Type repackType, const common::dataStructures::MountPolicy &mountPolicy, const bool forceDisabledTape, log::LogContext & lc) {
void Scheduler::queueRepack(const common::dataStructures::SecurityIdentity &cliIdentity, const SchedulerDatabase::QueueRepackRequest & repackRequest, log::LogContext & lc) {
// Check request sanity
std::string vid = repackRequest.m_vid;
std::string repackBufferURL = repackRequest.m_repackBufferURL;
if (vid.empty()) throw exception::UserError("Empty VID name.");
if (bufferURL.empty()) throw exception::UserError("Empty buffer URL.");
if (repackBufferURL.empty()) throw exception::UserError("Empty buffer URL.");
utils::Timer t;
checkTapeFullBeforeRepack(vid);
m_db.queueRepack(vid, bufferURL, repackType, mountPolicy, forceDisabledTape, lc);
m_db.queueRepack(repackRequest, lc);
log::TimingList tl;
tl.insertAndReset("schedulerDbTime", t);
log::ScopedParamContainer params(lc);
params.add("tapeVid", vid)
.add("repackType", toString(repackType))
.add("disabledTape", forceDisabledTape)
.add("bufferURL", bufferURL);
.add("repackType", toString(repackRequest.m_repackType))
.add("forceDisabledTape", repackRequest.m_forceDisabledTape)
.add("mountPolicy", repackRequest.m_mountPolicy.name)
.add("noRecall", repackRequest.m_noRecall)
.add("bufferURL", repackRequest.m_repackBufferURL);
tl.addToLog(params);
lc.log(log::INFO, "In Scheduler::queueRepack(): success.");
}
......@@ -473,6 +476,11 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
lc.log(log::WARNING,"In Scheduler::expandRepackRequest(), received XRootdException while listing files in the buffer");
}
} else {
if(repackInfo.noRecall){
//The buffer directory should be created if the --no-recall flag has been passed
//So we throw an exception
throw ExpandRepackRequestException("In Scheduler::expandRepackRequest(): the flag --use-buffer-do-not-recall is set but no buffer directory has been created.");
}
dir->mkdir();
}
}
......@@ -486,15 +494,37 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
repackRequest->m_dbReq->setExpandStartedAndChangeStatus();
uint64_t nbRetrieveSubrequestsQueued = 0;
while(archiveFilesForCatalogue.hasMore() && !expansionTimeReached) {
std::list<cta::common::dataStructures::ArchiveFile> archiveFilesFromCatalogue;
while(archiveFilesForCatalogue.hasMore()){
archiveFilesFromCatalogue.push_back(archiveFilesForCatalogue.next());
}
if(repackInfo.noRecall){
archiveFilesFromCatalogue.remove_if([&repackInfo, &filesInDirectory](const common::dataStructures::ArchiveFile & archiveFile){
//We remove all the elements that are not in the repack buffer so that we don't recall them
return std::find_if(filesInDirectory.begin(), filesInDirectory.end(),[&archiveFile, &repackInfo](const std::string & fseq){
//If we find a tape file that has the current fseq and belongs to the VID to repack, then we DON'T remove it from
//the archiveFilesFromCatalogue list
return std::find_if(archiveFile.tapeFiles.begin(), archiveFile.tapeFiles.end(),[&repackInfo, &fseq](const common::dataStructures::TapeFile & tapeFile){
//Can we find, in the archiveFilesFromCatalogue list an archiveFile that contains a tapefile that belongs to the VID to repack and that has the
//fseq of the current file read from the filesInDirectory list ?
return tapeFile.vid == repackInfo.vid && tapeFile.fSeq == cta::utils::toUint64(cta::utils::removePrefix(fseq,'0'));
}) != archiveFile.tapeFiles.end();
}) == filesInDirectory.end();
});
}
while(!archiveFilesFromCatalogue.empty() && !expansionTimeReached) {
size_t filesCount = 0;
uint64_t maxAddedFSeq = 0;
std::list<SchedulerDatabase::RepackRequest::Subrequest> retrieveSubrequests;
while(filesCount < c_defaultMaxNbFilesForRepack && !expansionTimeReached && archiveFilesForCatalogue.hasMore()){
while(filesCount < c_defaultMaxNbFilesForRepack && !expansionTimeReached && !archiveFilesFromCatalogue.empty()){
filesCount++;
fSeq++;
retrieveSubrequests.push_back(cta::SchedulerDatabase::RepackRequest::Subrequest());
auto archiveFile = archiveFilesForCatalogue.next();
auto archiveFile = archiveFilesFromCatalogue.front();
archiveFilesFromCatalogue.pop_front();
auto & retrieveSubRequest = retrieveSubrequests.back();
retrieveSubRequest.archiveFile = archiveFile;
......@@ -642,7 +672,7 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
}
timingList.insertAndReset("addSubrequestsAndUpdateStatsTime",t);
{
if(!expansionTimeReached && archiveFilesForCatalogue.hasMore()){
if(!expansionTimeReached && !archiveFilesFromCatalogue.empty()){
log::ScopedParamContainer params(lc);
params.add("tapeVid",repackInfo.vid);
timingList.addToLog(params);
......@@ -653,7 +683,7 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
log::ScopedParamContainer params(lc);
params.add("tapeVid",repackInfo.vid);
timingList.addToLog(params);
if(archiveFilesForCatalogue.hasMore()){
if(!archiveFilesFromCatalogue.empty()){
repackRequest->m_dbReq->requeueInToExpandQueue(lc);
lc.log(log::INFO,"Repack Request requeued in ToExpand queue.");
} else {
......
......@@ -198,8 +198,7 @@ public:
void queueLabel(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid,
const bool force);
void queueRepack(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid,
const std::string & bufferURL, const common::dataStructures::RepackInfo::Type repackType, const common::dataStructures::MountPolicy &mountPolicy,const bool disabledTape, log::LogContext & lc);
void queueRepack(const common::dataStructures::SecurityIdentity &cliIdentity, const SchedulerDatabase::QueueRepackRequest & repackRequest, log::LogContext & lc);
void cancelRepack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, log::LogContext & lc);
std::list<cta::common::dataStructures::RepackInfo> getRepacks();
cta::common::dataStructures::RepackInfo getRepack(const std::string &vid);
......
......@@ -143,6 +143,28 @@ public:
virtual std::list<cta::common::dataStructures::ArchiveJob> getArchiveJobs(
const std::string &tapePoolName) const = 0;
/**
* Class holding necessary repack request elements for queueing
* @param vid
* @param repackBufferURL
* @param repackType
* @param mountPolicy
* @param forceDisabledTape
* @param noRecall
*/
class QueueRepackRequest {
public:
QueueRepackRequest(const std::string & vid, const std::string repackBufferURL, const common::dataStructures::RepackInfo::Type repackType, const common::dataStructures::MountPolicy & mountPolicy, const bool forceDisabledTape, const bool noRecall):
m_vid(vid), m_repackBufferURL(repackBufferURL), m_repackType(repackType), m_mountPolicy(mountPolicy), m_forceDisabledTape(forceDisabledTape),m_noRecall(noRecall){}
std::string m_vid;
std::string m_repackBufferURL;
common::dataStructures::RepackInfo::Type m_repackType;
common::dataStructures::MountPolicy m_mountPolicy;
bool m_forceDisabledTape;
bool m_noRecall;
};
/*============ Archive management: tape server side =======================*/
/**
* The class used by the scheduler database to track the archive mounts
......@@ -416,8 +438,7 @@ public: