From 383694f556fff1465fb8bddd1a19018be8ee6871 Mon Sep 17 00:00:00 2001 From: Joao Afonso <joao.afonso@cern.ch> Date: Mon, 6 Mar 2023 19:53:39 +0100 Subject: [PATCH] Ignore 'NoSuchObject' exceptions thrown by non-existing objects during retrieve job requeuing --- ReleaseNotes.md | 1 + scheduler/OStoreDB/OStoreDB.cpp | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index e62e5d1016..c387a78af5 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -8,6 +8,7 @@ - cta/CTA#213 - Skip files with paths that have valid metadata ### Bug Fixes - cta/CTA#305 - AllCatalogueSchema file not created when updating schema +- cta/CTA#309 - Ignore 'NoSuchObject' exceptions thrown by non-existing objects during retrieve job requeuing - cta/CTA#320 - CTA No Oracle is failing # v4.8.5-1 diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 62703f4c26..5b3ed8bb46 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -1956,8 +1956,15 @@ void OStoreDB::requeueRetrieveJobs(std::list<cta::SchedulerDatabase::RetrieveJob OStoreDB::RetrieveJob *oStoreJob = dynamic_cast<OStoreDB::RetrieveJob *>(job); auto rr = std::make_shared<objectstore::RetrieveRequest>(oStoreJob->m_retrieveRequest.getAddressIfSet(), m_objectStore); rrlist.push_back(rr); - locks.emplace_back(*rr); - rr->fetch(); + try { + locks.emplace_back(*rr); + rr->fetch(); + } catch (cta::exception::NoSuchObject &) { + log::ScopedParamContainer params(logContext); + params.add("retrieveRequestId", oStoreJob->m_retrieveRequest.getAddressIfSet()); + logContext.log(log::INFO, "In OStoreDB::requeueRetrieveJobs(): no such retrieve request. Ignoring."); + continue; + } sorter.insertRetrieveRequest(rr, *m_agentReference, std::nullopt, logContext); } locks.clear(); @@ -1975,8 +1982,15 @@ void OStoreDB::requeueRetrieveRequestJobs(std::list<cta::SchedulerDatabase::Retr auto oStoreJob = dynamic_cast<OStoreDB::RetrieveJob *>(job); auto rr = std::make_shared<objectstore::RetrieveRequest>(oStoreJob->m_retrieveRequest.getAddressIfSet(), m_objectStore); rrlist.push_back(rr); - locks.emplace_back(*rr); - rr->fetch(); + try { + locks.emplace_back(*rr); + rr->fetch(); + } catch (cta::exception::NoSuchObject &) { + log::ScopedParamContainer params(logContext); + params.add("retrieveRequestId", oStoreJob->m_retrieveRequest.getAddressIfSet()); + logContext.log(log::INFO, "In OStoreDB::requeueRetrieveRequestJobs(): no such retrieve request. Ignoring."); + continue; + } rr->garbageCollectRetrieveRequest(m_agentReference->getAgentAddress(), *m_agentReference, logContext, m_catalogue, true); } locks.clear(); @@ -3674,8 +3688,15 @@ void OStoreDB::RetrieveMount::requeueJobBatch(std::list<std::unique_ptr<Schedule OStoreDB::RetrieveJob *job = dynamic_cast<OStoreDB::RetrieveJob *>(j.get()); auto rr = std::make_shared<objectstore::RetrieveRequest>(job->m_retrieveRequest.getAddressIfSet(), m_oStoreDB.m_objectStore); rrlist.push_back(rr); - locks.emplace_back(*rr); - rr->fetch(); + try { + locks.emplace_back(*rr); + rr->fetch(); + } catch (cta::exception::NoSuchObject &) { + log::ScopedParamContainer params(logContext); + params.add("retrieveRequestId", job->m_retrieveRequest.getAddressIfSet()); + logContext.log(log::INFO, "In OStoreDB::RetrieveMount::requeueJobBatch(): no such retrieve request. Ignoring."); + continue; + } sorter.insertRetrieveRequest(rr, *m_oStoreDB.m_agentReference, std::nullopt, logContext); } locks.clear(); -- GitLab