diff --git a/objectstore/AgentRegister.cpp b/objectstore/AgentRegister.cpp index 3d7123511455f4835a18adacecaa51e99a7a925b..6febd1f85f64a1c95ea446e9f15f216a3ea3e2c1 100644 --- a/objectstore/AgentRegister.cpp +++ b/objectstore/AgentRegister.cpp @@ -47,6 +47,9 @@ void cta::objectstore::AgentRegister::garbageCollect(const std::string &presumed if (!isEmpty()) { throw (NotEmpty("Trying to garbage collect a non-empty AgentRegister: internal error")); } + log::ScopedParamContainer params(lc); + params.add("agentRegisterObject", getAddressIfSet()); + lc.log(log::INFO, "In AgentRegister::garbageCollect(): Garbage collected and moved agent register object."); remove(); } diff --git a/objectstore/ArchiveQueue.cpp b/objectstore/ArchiveQueue.cpp index 10b3c57f55d9a1d6c035c9df1b4c5e59f5a8f3b7..313ff38258ea88eaea55470cbdb3c4d47bab58a4 100644 --- a/objectstore/ArchiveQueue.cpp +++ b/objectstore/ArchiveQueue.cpp @@ -129,6 +129,9 @@ void ArchiveQueue::garbageCollect(const std::string &presumedOwner, AgentReferen throw (NotEmpty("Trying to garbage collect a non-empty ArchiveQueue: internal error")); } remove(); + log::ScopedParamContainer params(lc); + params.add("archiveQueueObject", getAddressIfSet()); + lc.log(log::INFO, "In ArchiveQueue::garbageCollect(): Garbage collected and moved archive queue object."); } void ArchiveQueue::setTapePool(const std::string& name) { diff --git a/objectstore/ArchiveRequest.cpp b/objectstore/ArchiveRequest.cpp index 0e8b84be30ffc4c1b11ea5e54c948d0c1c4a7a99..2741808ec023867e8e83bcdb5a369e4d1913401e 100644 --- a/objectstore/ArchiveRequest.cpp +++ b/objectstore/ArchiveRequest.cpp @@ -87,7 +87,7 @@ bool cta::objectstore::ArchiveRequest::setJobSuccessful(uint16_t copyNumber) { } bool cta::objectstore::ArchiveRequest::addJobFailure(uint16_t copyNumber, - uint64_t mountId) { + uint64_t mountId, log::LogContext & lc) { checkPayloadWritable(); auto * jl = m_payload.mutable_jobs(); // Find the job and update the number of failures @@ -104,7 +104,7 @@ bool cta::objectstore::ArchiveRequest::addJobFailure(uint16_t copyNumber, } if (j.totalretries() >= j.maxtotalretries()) { j.set_status(serializers::AJS_Failed); - finishIfNecessary(); + finishIfNecessary(lc); return true; } else { j.set_status(serializers::AJS_PendingMount); @@ -372,7 +372,7 @@ void ArchiveRequest::garbageCollect(const std::string &presumedOwner, AgentRefer } // This could be the end of the request, with various consequences. // This is handled here: - if (finishIfNecessary()) { + if (finishIfNecessary(lc)) { std::string message="In ArchiveRequest::garbageCollect(): failed to requeue the job. Failed it and removed the request as a consequence."; if (backtrace.size()) message += " Backtrace follows."; lc.log(log::ERR, message); @@ -551,7 +551,7 @@ std::string ArchiveRequest::getJobOwner(uint16_t copyNumber) { } -bool ArchiveRequest::finishIfNecessary() { +bool ArchiveRequest::finishIfNecessary(log::LogContext & lc) { checkPayloadWritable(); // This function is typically called after changing the status of one job // in memory. If the request is complete, we will just remove it. @@ -564,6 +564,9 @@ bool ArchiveRequest::finishIfNecessary() { if (!finishedStatuses.count(j.status())) return false; remove(); + log::ScopedParamContainer params(lc); + params.add("archiveRequestObject", getAddressIfSet()); + lc.log(log::INFO, "In ArchiveRequest::finishIfNecessary(): Removing completed request."); return true; } diff --git a/objectstore/ArchiveRequest.hpp b/objectstore/ArchiveRequest.hpp index ebe78be3be94da038f3d1cd8b304e1739f6fa4ce..98efaa68fda446d39aa39c10a98f65ab3b012062 100644 --- a/objectstore/ArchiveRequest.hpp +++ b/objectstore/ArchiveRequest.hpp @@ -48,10 +48,10 @@ public: void setJobSelected(uint16_t copyNumber, const std::string & owner); void setJobPending(uint16_t copyNumber); bool setJobSuccessful(uint16_t copyNumber); //< returns true if this is the last job - bool addJobFailure(uint16_t copyNumber, uint64_t sessionId); //< returns true the job is failed + bool addJobFailure(uint16_t copyNumber, uint64_t sessionId, log::LogContext &lc); //< returns true the job is failed serializers::ArchiveJobStatus getJobStatus(uint16_t copyNumber); - bool finishIfNecessary(); /**< Handling of the consequences of a job status change for the entire request. - * This function returns true if the request got finished. */ + bool finishIfNecessary(log::LogContext & lc);/**< Handling of the consequences of a job status change for the entire request. + * This function returns true if the request got finished. */ // Mark all jobs as pending mount (following their linking to a tape pool) void setAllJobsLinkingToArchiveQueue(); // Mark all the jobs as being deleted, in case of a cancellation diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 6fca2c9e37e04e7ef2c1e3af153ff5f2dfc00391..e1412448c2020751c1a8e5a603007509056dfcee 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -2546,7 +2546,7 @@ void OStoreDB::ArchiveJob::fail(log::LogContext & lc) { objectstore::ScopedExclusiveLock arl(m_archiveRequest); m_archiveRequest.fetch(); // Add a job failure. If the job is failed, we will delete it. - if (m_archiveRequest.addJobFailure(tapeFile.copyNb, m_mountId)) { + if (m_archiveRequest.addJobFailure(tapeFile.copyNb, m_mountId, lc)) { // The job will not be retried. Either another jobs for the same request is // queued and keeps the request referenced or the request has been deleted. // In any case, we can forget it.