Commit 3aa34905 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

The status of the repack request is updated throughout all its lifecycle...

The status of the repack request is updated throughout all its lifecycle (Pending, ToExpand, Starting, Running, Complete or failed)
parent f795cb3d
......@@ -37,10 +37,6 @@ std::string toString(RepackInfo::Type type) {
std::string toString(RepackInfo::Status status) {
switch(status) {
case RepackInfo::Status::Aborted:
return "Aborted";
case RepackInfo::Status::Aborting:
return "Aborting";
case RepackInfo::Status::Complete:
return "Complete";
case RepackInfo::Status::Failed:
......
......@@ -43,10 +43,8 @@ struct RepackInfo {
ToExpand = 2,
Starting = 3,
Running = 4,
Aborting = 5,
Aborted = 6,
Complete = 7,
Failed = 8,
Complete = 5,
Failed = 6,
Undefined = 999
} status;
uint64_t totalFilesToArchive;
......
......@@ -729,7 +729,7 @@ void RetrieveRequest::updateLifecycleTiming(serializers::RetrieveRequest& payloa
typedef ::cta::objectstore::serializers::RetrieveJobStatus RetrieveJobStatus;
LifecycleTimingsSerDeser lifeCycleSerDeser;
lifeCycleSerDeser.deserialize(payload.lifecycle_timings());
switch(retrieveJob.status() == RetrieveJobStatus::RJS_ToTransferForUser){
switch(retrieveJob.status()){
case RetrieveJobStatus::RJS_ToTransferForUser:
if(retrieveJob.totalretries() == 0){
//totalretries = 0 then this is the first selection of the request
......
......@@ -492,10 +492,8 @@ enum RepackRequestStatus {
RRS_ToExpand = 2;
RRS_Starting = 3;
RRS_Running = 4;
RRS_Aborting = 5;
RRS_Aborted = 6;
RRS_Complete = 7;
RRS_Failed = 8;
RRS_Complete = 5;
RRS_Failed = 6;
}
// In order to properly handle retries in case of failure during reporting, we hold
......
......@@ -1038,7 +1038,7 @@ void OStoreDB::setRetrieveJobBatchReportedToUser(std::list<cta::SchedulerDatabas
log::ScopedParamContainer params(lc);
params.add("fileId", j->archiveFile.archiveFileID)
.add("objectAddress", castFromSchedDBJob(j)->m_retrieveRequest.getAddressIfSet());
lc.log(log::ERR, "In OStoreDB::setRetrieveJobBatchReported(): unexpected job status. Leaving the job as-is.");
lc.log(log::ERR, "In OStoreDB::setRetrieveJobBatchReportedToUser(): unexpected job status. Leaving the job as-is.");
}
}
}
......@@ -1793,6 +1793,7 @@ void OStoreDB::RepackRetrieveSuccessesReportBatch::report(log::LogContext& lc) {
objectstore::ScopedExclusiveLock rrl(m_repackRequest);
timingList.insertAndReset("successStatsLockTime", t);
m_repackRequest.fetch();
m_repackRequest.setStatus(common::dataStructures::RepackInfo::Status::Running);
timingList.insertAndReset("successStatsFetchTime", t);
m_repackRequest.reportRetriveSuccesses(ssl);
timingList.insertAndReset("successStatsUpdateTime", t);
......@@ -2291,7 +2292,7 @@ void OStoreDB::RepackRequest::addSubrequests(std::list<Subrequest>& repackSubreq
//------------------------------------------------------------------------------
void OStoreDB::RepackRequest::expandDone() {
// We are now done with the repack request. We can set its status.
ScopedSharedLock rrl(m_repackRequest);
ScopedExclusiveLock rrl(m_repackRequest);
m_repackRequest.fetch();
// After expansion, 2 statuses are possible: starting (nothing reported as done) or running (anything reported as done).
// We can find that out from the statistics...
......
......@@ -526,6 +526,7 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
fSeq = std::max(fSeq, maxAddedFSeq + 1);
repackRequest->m_dbReq->setLastExpandedFSeq(fSeq);
}
repackRequest->m_dbReq->expandDone();
}
//------------------------------------------------------------------------------
......
......@@ -27,7 +27,7 @@ cta::SchedulerDatabase::~SchedulerDatabase() throw() { }
SchedulerDatabase::RepackRequestStatistics::RepackRequestStatistics() {
typedef common::dataStructures::RepackInfo::Status Status;
for (auto & s: {Status::Aborted, Status::Aborting, Status::Complete, Status::Failed, Status::Pending,
for (auto & s: {Status::Complete, Status::Failed, Status::Pending,
Status::Running, Status::Starting, Status::ToExpand})
operator [](s) = 0;
}
......
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