diff --git a/objectstore/Agent.cpp b/objectstore/Agent.cpp index 8653aab3de26d3aba763b574fe723cb3723cf312..10d0ef91e9f5bfefcbd80d5581d2047cc8f556cf 100644 --- a/objectstore/Agent.cpp +++ b/objectstore/Agent.cpp @@ -52,10 +52,8 @@ void cta::objectstore::Agent::insertAndRegisterSelf(log::LogContext & lc) { // is set. // We need to get hold of the agent register, which we suppose is available RootEntry re(m_objectStore); - ScopedSharedLock reLock(re); - re.fetch(); + re.fetchNoLock(); AgentRegister ar(re.getAgentRegisterAddress(), m_objectStore); - reLock.release(); // Then we should first create a pointer to our agent ScopedExclusiveLock arLock(ar); ar.fetch(); @@ -116,10 +114,8 @@ void cta::objectstore::Agent::garbageCollect(const std::string& presumedOwner, A if (m_header.owner() == presumedOwner) { // We need to get hold of the agent register, which we suppose is available RootEntry re(m_objectStore); - ScopedSharedLock reLock(re); - re.fetch(); + re.fetchNoLock(); AgentRegister ar(re.getAgentRegisterAddress(), m_objectStore); - reLock.release(); // Then we should first create a pointer to our agent ScopedExclusiveLock arLock(ar); ar.fetch(); diff --git a/objectstore/Helpers.cpp b/objectstore/Helpers.cpp index eebcd25da40e45d6b6b44838dc8f1a0b5df08866..c43eb70bfbabc0ee2b100d0eb85ca6772d30bf1c 100644 --- a/objectstore/Helpers.cpp +++ b/objectstore/Helpers.cpp @@ -353,9 +353,7 @@ std::list<SchedulerDatabase::RetrieveQueueStatistics> Helpers::getRetrieveQueueS std::list<SchedulerDatabase::RetrieveQueueStatistics> ret; // Find the retrieve queues for each vid if they exist (absence is possible). RootEntry re(objectstore); - ScopedSharedLock rel(re); - re.fetch(); - rel.release(); + re.fetchNoLock(); for (auto &tf:criteria.archiveFile.tapeFiles) { if (!vidsToConsider.count(tf.second.vid)) continue; @@ -371,9 +369,7 @@ std::list<SchedulerDatabase::RetrieveQueueStatistics> Helpers::getRetrieveQueueS continue; } RetrieveQueue rq(rqAddr, objectstore); - ScopedSharedLock rql(rq); - rq.fetch(); - rql.release(); + rq.fetchNoLock(); if (rq.getVid() != tf.second.vid) throw cta::exception::Exception("In OStoreDB::getRetrieveQueueStatistics(): unexpected vid for retrieve queue"); ret.push_back(SchedulerDatabase::RetrieveQueueStatistics()); diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 870227844f4c113b9919d520fffc421e8bfaaec8..570d60b8bfdb313db5d8e3b739e432c3fa608251 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -590,10 +590,8 @@ void OStoreDB::deleteArchiveRequest(const std::string &diskInstanceName, uint64_t fileId) { // First of, find the archive request from all the tape pools. objectstore::RootEntry re(m_objectStore); - objectstore::ScopedSharedLock rel(re); - re.fetch(); + re.fetchNoLock(); auto aql = re.dumpArchiveQueues(); - rel.release(); for (auto & aqp: aql) { objectstore::ArchiveQueue aq(aqp.address, m_objectStore); ScopedSharedLock aqlock(aq); @@ -721,10 +719,8 @@ OStoreDB::ArchiveToFileRequestCancelation::~ArchiveToFileRequestCancelation() { std::list<cta::common::dataStructures::ArchiveJob> OStoreDB::getArchiveJobs(const std::string& tapePoolName) const { objectstore::RootEntry re(m_objectStore); - objectstore::ScopedSharedLock rel(re); - re.fetch(); + re.fetchNoLock(); auto tpl = re.dumpArchiveQueues(); - rel.release(); for (auto & tpp:tpl) { if (tpp.tapePool != tapePoolName) continue; std::list<cta::common::dataStructures::ArchiveJob> ret; @@ -776,10 +772,8 @@ std::list<cta::common::dataStructures::ArchiveJob> std::map<std::string, std::list<common::dataStructures::ArchiveJob> > OStoreDB::getArchiveJobs() const { objectstore::RootEntry re(m_objectStore); - objectstore::ScopedSharedLock rel(re); - re.fetch(); + re.fetchNoLock(); auto tpl = re.dumpArchiveQueues(); - rel.release(); std::map<std::string, std::list<common::dataStructures::ArchiveJob> > ret; for (auto & tpp:tpl) { objectstore::ArchiveQueue osaq(tpp.address, m_objectStore); @@ -976,10 +970,8 @@ std::map<std::string, std::list<common::dataStructures::RetrieveJob> > OStoreDB: // We will walk all the tapes to get the jobs. std::map<std::string, std::list<common::dataStructures::RetrieveJob> > ret; RootEntry re(m_objectStore); - ScopedSharedLock rel(re); - re.fetch(); + re.fetchNoLock(); auto rql=re.dumpRetrieveQueues(); - rel.release(); for (auto & rqp: rql) { // This implementation gives imperfect consistency. Do we need better? (If so, TODO: improve). // This implementation is racy, so we tolerate that the queue is gone.