Commit a0bf18c9 authored by Michael Davis's avatar Michael Davis
Browse files

[objectstore] Fixes unit tests

Objectstore GC Repack unit tests rely on a specific string in an exception message.
parent 36d3e007
...@@ -61,6 +61,7 @@ set (COMMON_LIB_SRC_FILES ...@@ -61,6 +61,7 @@ set (COMMON_LIB_SRC_FILES
dataStructures/QueueAndMountSummary.cpp dataStructures/QueueAndMountSummary.cpp
dataStructures/ReadTestResult.cpp dataStructures/ReadTestResult.cpp
dataStructures/RepackInfo.cpp dataStructures/RepackInfo.cpp
dataStructures/RepackQueueType.cpp
dataStructures/RequesterGroupMountRule.cpp dataStructures/RequesterGroupMountRule.cpp
dataStructures/RequesterIdentity.cpp dataStructures/RequesterIdentity.cpp
dataStructures/RequesterMountRule.cpp dataStructures/RequesterMountRule.cpp
......
...@@ -55,19 +55,19 @@ std::string toString(RepackInfo::Status status) { ...@@ -55,19 +55,19 @@ std::string toString(RepackInfo::Status status) {
} }
} }
cta::objectstore::RepackQueueType RepackInfo::getQueueType(){ RepackQueueType RepackInfo::getQueueType(){
switch(status){ switch(status){
case RepackInfo::Status::Pending: case RepackInfo::Status::Pending:
return cta::objectstore::RepackQueueType::Pending; return RepackQueueType::Pending;
case RepackInfo::Status::ToExpand: case RepackInfo::Status::ToExpand:
return cta::objectstore::RepackQueueType::ToExpand; return RepackQueueType::ToExpand;
case RepackInfo::Status::Running: case RepackInfo::Status::Running:
case RepackInfo::Status::Starting: case RepackInfo::Status::Starting:
if(!isExpandFinished) return cta::objectstore::RepackQueueType::ToExpand; if(!isExpandFinished) return RepackQueueType::ToExpand;
goto explicit_default; goto explicit_default;
default: default:
explicit_default: explicit_default:
throw cta::exception::Exception("The status "+toString(status)+" have no corresponding queue."); throw cta::exception::Exception("The status "+toString(status)+" has no corresponding queue type.");
} }
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <string> #include <string>
#include <list> #include <list>
#include "objectstore/RepackQueueType.hpp" #include "RepackQueueType.hpp"
#include "EntryLog.hpp" #include "EntryLog.hpp"
#include "common/optional.hpp" #include "common/optional.hpp"
...@@ -89,7 +89,7 @@ struct RepackInfo { ...@@ -89,7 +89,7 @@ struct RepackInfo {
// std::string repackStatus; // std::string repackStatus;
// std::map<uint64_t,std::string> errors; // std::map<uint64_t,std::string> errors;
// EntryLog creationLog; // EntryLog creationLog;
cta::objectstore::RepackQueueType getQueueType(); RepackQueueType getQueueType();
}; // struct RepackInfo }; // struct RepackInfo
std::string toString(RepackInfo::Type type); std::string toString(RepackInfo::Type type);
......
/* /**
* The CERN Tape Archive (CTA) project * The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN * Copyright © 2021 CERN
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "RepackQueueType.hpp" #include "RepackQueueType.hpp"
#include "common/exception/Exception.hpp" #include "common/exception/Exception.hpp"
namespace cta { namespace objectstore { namespace cta { namespace common { namespace dataStructures {
std::string toString(RepackQueueType queueType) { std::string toString(RepackQueueType queueType) {
switch(queueType) { switch(queueType) {
...@@ -31,4 +31,4 @@ std::string toString(RepackQueueType queueType) { ...@@ -31,4 +31,4 @@ std::string toString(RepackQueueType queueType) {
throw exception::Exception("In toString(RepackQueueType): unexpected queue type."); throw exception::Exception("In toString(RepackQueueType): unexpected queue type.");
} }
}} // namespace cta::objectstore }}} // namespace cta::common::dataStructures
\ No newline at end of file
/* /**
* The CERN Tape Archive (CTA) project * The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN * Copyright © 2021 CERN
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <string> #include <string>
namespace cta { namespace objectstore { namespace cta { namespace common { namespace dataStructures {
enum class RepackQueueType { Pending, ToExpand }; enum class RepackQueueType { Pending, ToExpand };
std::string toString(RepackQueueType queueType); std::string toString(RepackQueueType queueType);
}} // namespace cta::objectstore }}} // namespace cta::common::dataStructures
...@@ -91,7 +91,6 @@ add_library (ctaobjectstore SHARED ...@@ -91,7 +91,6 @@ add_library (ctaobjectstore SHARED
RepackQueue.cpp RepackQueue.cpp
RepackQueuePendingAlgorithms.cpp RepackQueuePendingAlgorithms.cpp
RepackQueueToExpandAlgorithms.cpp RepackQueueToExpandAlgorithms.cpp
RepackQueueType.cpp
BackendVFS.cpp BackendVFS.cpp
BackendRados.cpp BackendRados.cpp
BackendPopulator.cpp BackendPopulator.cpp
......
...@@ -741,7 +741,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestPending) { ...@@ -741,7 +741,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestPending) {
cta::objectstore::RootEntry re(be); cta::objectstore::RootEntry re(be);
cta::objectstore::ScopedExclusiveLock rel(re); cta::objectstore::ScopedExclusiveLock rel(re);
re.fetch(); re.fetch();
std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::objectstore::RepackQueueType::Pending); std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::common::dataStructures::RepackQueueType::Pending);
cta::objectstore::RepackQueue rq(repackQueueAddr,be); cta::objectstore::RepackQueue rq(repackQueueAddr,be);
cta::objectstore::ScopedExclusiveLock rql(rq); cta::objectstore::ScopedExclusiveLock rql(rq);
rq.fetch(); rq.fetch();
...@@ -822,7 +822,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestToExpand) { ...@@ -822,7 +822,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestToExpand) {
cta::objectstore::RootEntry re(be); cta::objectstore::RootEntry re(be);
cta::objectstore::ScopedExclusiveLock rel(re); cta::objectstore::ScopedExclusiveLock rel(re);
re.fetch(); re.fetch();
std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::objectstore::RepackQueueType::ToExpand); std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::common::dataStructures::RepackQueueType::ToExpand);
cta::objectstore::RepackQueue rq(repackQueueAddr,be); cta::objectstore::RepackQueue rq(repackQueueAddr,be);
cta::objectstore::ScopedExclusiveLock rql(rq); cta::objectstore::ScopedExclusiveLock rql(rq);
rq.fetch(); rq.fetch();
...@@ -905,7 +905,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandNotFinished) { ...@@ -905,7 +905,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandNotFinished) {
cta::objectstore::RootEntry re(be); cta::objectstore::RootEntry re(be);
cta::objectstore::ScopedExclusiveLock rel(re); cta::objectstore::ScopedExclusiveLock rel(re);
re.fetch(); re.fetch();
std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::objectstore::RepackQueueType::ToExpand); std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::common::dataStructures::RepackQueueType::ToExpand);
cta::objectstore::RepackQueue rq(repackQueueAddr,be); cta::objectstore::RepackQueue rq(repackQueueAddr,be);
cta::objectstore::ScopedExclusiveLock rql(rq); cta::objectstore::ScopedExclusiveLock rql(rq);
rq.fetch(); rq.fetch();
...@@ -993,7 +993,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandFinished) { ...@@ -993,7 +993,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandFinished) {
cta::objectstore::RootEntry re(be); cta::objectstore::RootEntry re(be);
cta::objectstore::ScopedExclusiveLock rel(re); cta::objectstore::ScopedExclusiveLock rel(re);
re.fetch(); re.fetch();
std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::objectstore::RepackQueueType::ToExpand); std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::common::dataStructures::RepackQueueType::ToExpand);
cta::objectstore::RepackQueue rq(repackQueueAddr,be); cta::objectstore::RepackQueue rq(repackQueueAddr,be);
cta::objectstore::ScopedExclusiveLock rql(rq); cta::objectstore::ScopedExclusiveLock rql(rq);
rq.fetch(); rq.fetch();
...@@ -1004,7 +1004,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandFinished) { ...@@ -1004,7 +1004,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandFinished) {
cta::objectstore::RootEntry re(be); cta::objectstore::RootEntry re(be);
cta::objectstore::ScopedExclusiveLock rel(re); cta::objectstore::ScopedExclusiveLock rel(re);
re.fetch(); re.fetch();
std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::objectstore::RepackQueueType::Pending); std::string repackQueueAddr = re.addOrGetRepackQueueAndCommit(agentRef,cta::common::dataStructures::RepackQueueType::Pending);
cta::objectstore::RepackQueue rq(repackQueueAddr,be); cta::objectstore::RepackQueue rq(repackQueueAddr,be);
cta::objectstore::ScopedExclusiveLock rql(rq); cta::objectstore::ScopedExclusiveLock rql(rq);
rq.fetch(); rq.fetch();
...@@ -1019,7 +1019,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandFinished) { ...@@ -1019,7 +1019,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestRunningExpandFinished) {
//Check the logs contains the failed to requeue message //Check the logs contains the failed to requeue message
std::string logToCheck = strLogger.getLog(); std::string logToCheck = strLogger.getLog();
logToCheck += ""; logToCheck += "";
ASSERT_NE(std::string::npos,logToCheck.find("MSG=\"In RepackRequest::garbageCollect(): failed to requeue the RepackRequest (leaving it as it is) : The status Running have no corresponding queue.\"")); ASSERT_NE(std::string::npos,logToCheck.find("MSG=\"In RepackRequest::garbageCollect(): failed to requeue the RepackRequest (leaving it as it is) : The status Running has no corresponding queue type.\""));
} }
TEST(ObjectStore, GarbageCollectorRepackRequestStarting) { TEST(ObjectStore, GarbageCollectorRepackRequestStarting) {
...@@ -1097,7 +1097,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestStarting) { ...@@ -1097,7 +1097,7 @@ TEST(ObjectStore, GarbageCollectorRepackRequestStarting) {
//Check the logs contains the failed to requeue message //Check the logs contains the failed to requeue message
std::string logToCheck = strLogger.getLog(); std::string logToCheck = strLogger.getLog();
logToCheck += ""; logToCheck += "";
ASSERT_NE(std::string::npos,logToCheck.find("MSG=\"In RepackRequest::garbageCollect(): failed to requeue the RepackRequest (leaving it as it is) : The status Starting have no corresponding queue.\"")); ASSERT_NE(std::string::npos,logToCheck.find("MSG=\"In RepackRequest::garbageCollect(): failed to requeue the RepackRequest (leaving it as it is) : The status Starting has no corresponding queue type.\""));
} }
TEST(ObjectStore, GarbageCollectorRetrieveAllStatusesAndQueues) { TEST(ObjectStore, GarbageCollectorRetrieveAllStatusesAndQueues) {
......
...@@ -273,7 +273,7 @@ void Helpers::getLockedAndFetchedJobQueue<RetrieveQueue>(RetrieveQueue& retrieve ...@@ -273,7 +273,7 @@ void Helpers::getLockedAndFetchedJobQueue<RetrieveQueue>(RetrieveQueue& retrieve
// Helpers::getLockedAndFetchedRepackQueue() // Helpers::getLockedAndFetchedRepackQueue()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void Helpers::getLockedAndFetchedRepackQueue(RepackQueue& queue, ScopedExclusiveLock& queueLock, AgentReference& agentReference, void Helpers::getLockedAndFetchedRepackQueue(RepackQueue& queue, ScopedExclusiveLock& queueLock, AgentReference& agentReference,
RepackQueueType queueType, log::LogContext& lc) { common::dataStructures::RepackQueueType queueType, log::LogContext& lc) {
// Try and find the repack queue. // Try and find the repack queue.
Backend & be = queue.m_objectStore; Backend & be = queue.m_objectStore;
for (auto i: cta::range<size_t>(5)) { for (auto i: cta::range<size_t>(5)) {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "catalogue/Catalogue.hpp" #include "catalogue/Catalogue.hpp"
#include "scheduler/OStoreDB/OStoreDB.hpp" #include "scheduler/OStoreDB/OStoreDB.hpp"
#include "JobQueueType.hpp" #include "JobQueueType.hpp"
#include "RepackQueueType.hpp" #include "common/dataStructures/RepackQueueType.hpp"
#include <string> #include <string>
#include <set> #include <set>
#include <future> #include <future>
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
*/ */
static void getLockedAndFetchedRepackQueue(RepackQueue & queue, static void getLockedAndFetchedRepackQueue(RepackQueue & queue,
ScopedExclusiveLock & queueLock, AgentReference & agentReference, ScopedExclusiveLock & queueLock, AgentReference & agentReference,
RepackQueueType queueType, log::LogContext & lc); common::dataStructures::RepackQueueType queueType, log::LogContext & lc);
CTA_GENERATE_EXCEPTION_CLASS(NoTapeAvailableForRetrieve); CTA_GENERATE_EXCEPTION_CLASS(NoTapeAvailableForRetrieve);
/** /**
......
...@@ -429,11 +429,11 @@ getElementSummary(const PoppedElement& poppedElement) -> PoppedElementsSummary { ...@@ -429,11 +429,11 @@ getElementSummary(const PoppedElement& poppedElement) -> PoppedElementsSummary {
template<> template<>
struct ContainerTraits<RepackQueue,RepackQueuePending>::QueueType{ struct ContainerTraits<RepackQueue,RepackQueuePending>::QueueType{
objectstore::RepackQueueType value = objectstore::RepackQueueType::Pending; common::dataStructures::RepackQueueType value = common::dataStructures::RepackQueueType::Pending;
}; };
template<> template<>
struct ContainerTraits<RepackQueue,RepackQueueToExpand>::QueueType{ struct ContainerTraits<RepackQueue,RepackQueueToExpand>::QueueType{
objectstore::RepackQueueType value = objectstore::RepackQueueType::ToExpand; common::dataStructures::RepackQueueType value = common::dataStructures::RepackQueueType::ToExpand;
}; };
}} // namespace cta::objectstore }} // namespace cta::objectstore
...@@ -809,14 +809,14 @@ void RootEntry::removeRepackIndexAndCommit(log::LogContext& lc) { ...@@ -809,14 +809,14 @@ void RootEntry::removeRepackIndexAndCommit(log::LogContext& lc) {
// ================ Repack index manipulation ================================== // ================ Repack index manipulation ==================================
// ============================================================================= // =============================================================================
std::string RootEntry::getRepackQueueAddress(RepackQueueType queueType) { std::string RootEntry::getRepackQueueAddress(common::dataStructures::RepackQueueType queueType) {
checkPayloadReadable(); checkPayloadReadable();
switch (queueType) { switch (queueType) {
case RepackQueueType::Pending: case common::dataStructures::RepackQueueType::Pending:
if (!m_payload.has_repackrequestspendingqueuepointer()) if (!m_payload.has_repackrequestspendingqueuepointer())
throw NoSuchRepackQueue("In RootEntry::getRepackQueueAddress: pending queue no set."); throw NoSuchRepackQueue("In RootEntry::getRepackQueueAddress: pending queue no set.");
return m_payload.repackrequestspendingqueuepointer().address(); return m_payload.repackrequestspendingqueuepointer().address();
case RepackQueueType::ToExpand: case common::dataStructures::RepackQueueType::ToExpand:
if (!m_payload.has_repackrequeststoexpandqueuepointer()) if (!m_payload.has_repackrequeststoexpandqueuepointer())
throw NoSuchRepackQueue("In RootEntry::getRepackQueueAddress: toExpand queue not set."); throw NoSuchRepackQueue("In RootEntry::getRepackQueueAddress: toExpand queue not set.");
return m_payload.repackrequeststoexpandqueuepointer().address(); return m_payload.repackrequeststoexpandqueuepointer().address();
...@@ -824,14 +824,14 @@ std::string RootEntry::getRepackQueueAddress(RepackQueueType queueType) { ...@@ -824,14 +824,14 @@ std::string RootEntry::getRepackQueueAddress(RepackQueueType queueType) {
throw cta::exception::Exception("In RootEntry::getRepackQueueAddress(): unexptected queue type."); throw cta::exception::Exception("In RootEntry::getRepackQueueAddress(): unexptected queue type.");
} }
void RootEntry::clearRepackQueueAddress(RepackQueueType queueType) { void RootEntry::clearRepackQueueAddress(common::dataStructures::RepackQueueType queueType) {
checkPayloadWritable(); checkPayloadWritable();
switch (queueType) { switch (queueType) {
case RepackQueueType::Pending: case common::dataStructures::RepackQueueType::Pending:
if (!m_payload.has_repackrequestspendingqueuepointer()) if (!m_payload.has_repackrequestspendingqueuepointer())
throw NoSuchRepackQueue("In RootEntry::clearRepackQueueAddress: pending queue no set."); throw NoSuchRepackQueue("In RootEntry::clearRepackQueueAddress: pending queue no set.");
return m_payload.mutable_repackrequestspendingqueuepointer()->Clear(); return m_payload.mutable_repackrequestspendingqueuepointer()->Clear();
case RepackQueueType::ToExpand: case common::dataStructures::RepackQueueType::ToExpand:
if (!m_payload.has_repackrequeststoexpandqueuepointer()) if (!m_payload.has_repackrequeststoexpandqueuepointer())
throw NoSuchRepackQueue("In RootEntry::clearRepackQueueAddress: toExpand queue not set."); throw NoSuchRepackQueue("In RootEntry::clearRepackQueueAddress: toExpand queue not set.");
return m_payload.mutable_repackrequeststoexpandqueuepointer()->Clear(); return m_payload.mutable_repackrequeststoexpandqueuepointer()->Clear();
...@@ -839,16 +839,16 @@ void RootEntry::clearRepackQueueAddress(RepackQueueType queueType) { ...@@ -839,16 +839,16 @@ void RootEntry::clearRepackQueueAddress(RepackQueueType queueType) {
throw cta::exception::Exception("In RootEntry::clearRepackQueueAddress(): unexptected queue type."); throw cta::exception::Exception("In RootEntry::clearRepackQueueAddress(): unexptected queue type.");
} }
void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogContext& lc) { void RootEntry::removeRepackQueueAndCommit(common::dataStructures::RepackQueueType queueType, log::LogContext& lc) {
checkPayloadWritable(); checkPayloadWritable();
// find the address of the repack queue object // find the address of the repack queue object
try { try {
bool hasQueue; bool hasQueue;
switch (queueType) { switch (queueType) {
case RepackQueueType::Pending: case common::dataStructures::RepackQueueType::Pending:
hasQueue = m_payload.has_repackrequestspendingqueuepointer(); hasQueue = m_payload.has_repackrequestspendingqueuepointer();
break; break;
case RepackQueueType::ToExpand: case common::dataStructures::RepackQueueType::ToExpand:
hasQueue = m_payload.has_repackrequeststoexpandqueuepointer(); hasQueue = m_payload.has_repackrequeststoexpandqueuepointer();
} }
if (!hasQueue) { if (!hasQueue) {
...@@ -856,10 +856,10 @@ void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogCo ...@@ -856,10 +856,10 @@ void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogCo
} }
std::string queueAddress; std::string queueAddress;
switch (queueType) { switch (queueType) {
case RepackQueueType::Pending: case common::dataStructures::RepackQueueType::Pending:
queueAddress = m_payload.repackrequestspendingqueuepointer().address(); queueAddress = m_payload.repackrequestspendingqueuepointer().address();
break; break;
case RepackQueueType::ToExpand: case common::dataStructures::RepackQueueType::ToExpand:
queueAddress = m_payload.repackrequeststoexpandqueuepointer().address(); queueAddress = m_payload.repackrequeststoexpandqueuepointer().address();
} }
// Open the repack queue object // Open the repack queue object
...@@ -896,10 +896,10 @@ void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogCo ...@@ -896,10 +896,10 @@ void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogCo
deleteFromRootEntry: deleteFromRootEntry:
// ... and remove it from our entry // ... and remove it from our entry
switch (queueType) { switch (queueType) {
case RepackQueueType::Pending: case common::dataStructures::RepackQueueType::Pending:
m_payload.clear_repackrequestspendingqueuepointer(); m_payload.clear_repackrequestspendingqueuepointer();
break; break;
case RepackQueueType::ToExpand: case common::dataStructures::RepackQueueType::ToExpand:
m_payload.clear_repackrequeststoexpandqueuepointer(); m_payload.clear_repackrequeststoexpandqueuepointer();
} }
commit(); commit();
...@@ -914,7 +914,7 @@ void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogCo ...@@ -914,7 +914,7 @@ void RootEntry::removeRepackQueueAndCommit(RepackQueueType queueType, log::LogCo
} }
} }
std::string RootEntry::addOrGetRepackQueueAndCommit(AgentReference& agentRef, RepackQueueType queueType) { std::string RootEntry::addOrGetRepackQueueAndCommit(AgentReference& agentRef, common::dataStructures::RepackQueueType queueType) {
checkPayloadWritable(); checkPayloadWritable();
// Check the repack queue does not already exist // Check the repack queue does not already exist
try { try {
...@@ -924,17 +924,17 @@ std::string RootEntry::addOrGetRepackQueueAndCommit(AgentReference& agentRef, Re ...@@ -924,17 +924,17 @@ std::string RootEntry::addOrGetRepackQueueAndCommit(AgentReference& agentRef, Re
// Insert the archive queue pointer in the root entry, then the queue. // Insert the archive queue pointer in the root entry, then the queue.
std::string repackQueueNameHeader = "RepackQueue"; std::string repackQueueNameHeader = "RepackQueue";
switch(queueType) { switch(queueType) {
case RepackQueueType::Pending: repackQueueNameHeader+="Pending"; break; case common::dataStructures::RepackQueueType::Pending: repackQueueNameHeader+="Pending"; break;
case RepackQueueType::ToExpand: repackQueueNameHeader+="ToExpand"; break; case common::dataStructures::RepackQueueType::ToExpand: repackQueueNameHeader+="ToExpand"; break;
default: break; default: break;
} }
std::string repackQueueAddress = agentRef.nextId(repackQueueNameHeader); std::string repackQueueAddress = agentRef.nextId(repackQueueNameHeader);
// Now move create a reference in the root entry // Now move create a reference in the root entry
switch(queueType) { switch(queueType) {
case RepackQueueType::Pending: case common::dataStructures::RepackQueueType::Pending:
m_payload.mutable_repackrequestspendingqueuepointer()->set_address(repackQueueAddress); m_payload.mutable_repackrequestspendingqueuepointer()->set_address(repackQueueAddress);
break; break;
case RepackQueueType::ToExpand: case common::dataStructures::RepackQueueType::ToExpand:
m_payload.mutable_repackrequeststoexpandqueuepointer()->set_address(repackQueueAddress); m_payload.mutable_repackrequeststoexpandqueuepointer()->set_address(repackQueueAddress);
break; break;
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "objectstore/cta.pb.h" #include "objectstore/cta.pb.h"
#include "JobQueueType.hpp" #include "JobQueueType.hpp"
#include "RepackQueueType.hpp" #include "common/dataStructures/RepackQueueType.hpp"
#include "Backend.hpp" #include "Backend.hpp"
#include "ObjectOps.hpp" #include "ObjectOps.hpp"
#include "EntryLogSerDeser.hpp" #include "EntryLogSerDeser.hpp"
...@@ -140,12 +140,12 @@ public: ...@@ -140,12 +140,12 @@ public:
// Repack queues manipulations =============================================== // Repack queues manipulations ===============================================
CTA_GENERATE_EXCEPTION_CLASS(RepackQueueNotEmpty); CTA_GENERATE_EXCEPTION_CLASS(RepackQueueNotEmpty);
CTA_GENERATE_EXCEPTION_CLASS(NoSuchRepackQueue); CTA_GENERATE_EXCEPTION_CLASS(NoSuchRepackQueue);
std::string getRepackQueueAddress(RepackQueueType queueType); std::string getRepackQueueAddress(common::dataStructures::RepackQueueType queueType);
std::string addOrGetRepackQueueAndCommit(AgentReference & agentRef, RepackQueueType queueType); std::string addOrGetRepackQueueAndCommit(AgentReference & agentRef, common::dataStructures::RepackQueueType queueType);
void removeRepackQueueAndCommit(RepackQueueType queueType, log::LogContext & lc); void removeRepackQueueAndCommit(common::dataStructures::RepackQueueType queueType, log::LogContext & lc);
private: private:
void setRepackQueueAddress(RepackQueueType queueType, const std::string &queueAddress); void setRepackQueueAddress(common::dataStructures::RepackQueueType queueType, const std::string &queueAddress);
void clearRepackQueueAddress(RepackQueueType queueType); void clearRepackQueueAddress(common::dataStructures::RepackQueueType queueType);
public: public:
// Dump the root entry // Dump the root entry
......
...@@ -1900,7 +1900,7 @@ auto OStoreDB::getRepackStatistics() -> std::unique_ptr<SchedulerDatabase::Repac ...@@ -1900,7 +1900,7 @@ auto OStoreDB::getRepackStatistics() -> std::unique_ptr<SchedulerDatabase::Repac
typedRet(new OStoreDB::RepackRequestPromotionStatistics(m_objectStore, *m_agentReference)); typedRet(new OStoreDB::RepackRequestPromotionStatistics(m_objectStore, *m_agentReference));
// Try to get the lock // Try to get the lock
try { try {
typedRet->m_pendingRepackRequestQueue.setAddress(re.getRepackQueueAddress(RepackQueueType::Pending)); typedRet->m_pendingRepackRequestQueue.setAddress(re.getRepackQueueAddress(common::dataStructures::RepackQueueType::Pending));
typedRet->m_lockOnPendingRepackRequestsQueue.lock(typedRet->m_pendingRepackRequestQueue); typedRet->m_lockOnPendingRepackRequestsQueue.lock(typedRet->m_pendingRepackRequestQueue);
} catch (...) { } catch (...) {
throw SchedulerDatabase::RepackRequestStatistics::NoPendingRequestQueue("In OStoreDB::getRepackStatistics(): could not lock the pending requests queue."); throw SchedulerDatabase::RepackRequestStatistics::NoPendingRequestQueue("In OStoreDB::getRepackStatistics(): could not lock the pending requests queue.");
......
...@@ -3382,7 +3382,7 @@ TEST_P(SchedulerTest, expandRepackRequestAddCopiesOnly) { ...@@ -3382,7 +3382,7 @@ TEST_P(SchedulerTest, expandRepackRequestAddCopiesOnly) {
cta::objectstore::RootEntry re(backend); cta::objectstore::RootEntry re(backend);
re.fetchNoLock(); re.fetchNoLock();
std::string repackQueueAddress = re.getRepackQueueAddress(RepackQueueType::Pending); std::string repackQueueAddress = re.getRepackQueueAddress(common::dataStructures::RepackQueueType::Pending);
cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend); cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend);
repackQueuePending.fetchNoLock(); repackQueuePending.fetchNoLock();
...@@ -3640,7 +3640,7 @@ TEST_P(SchedulerTest, expandRepackRequestMoveAndAddCopies){ ...@@ -3640,7 +3640,7 @@ TEST_P(SchedulerTest, expandRepackRequestMoveAndAddCopies){
cta::objectstore::RootEntry re(backend); cta::objectstore::RootEntry re(backend);
re.fetchNoLock(); re.fetchNoLock();
std::string repackQueueAddress = re.getRepackQueueAddress(RepackQueueType::Pending); std::string repackQueueAddress = re.getRepackQueueAddress(common::dataStructures::RepackQueueType::Pending);
cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend); cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend);
repackQueuePending.fetchNoLock(); repackQueuePending.fetchNoLock();
...@@ -3888,7 +3888,7 @@ TEST_P(SchedulerTest, cancelRepackRequest) { ...@@ -3888,7 +3888,7 @@ TEST_P(SchedulerTest, cancelRepackRequest) {
cta::objectstore::RootEntry re(backend); cta::objectstore::RootEntry re(backend);
re.fetchNoLock(); re.fetchNoLock();
std::string repackQueueAddress = re.getRepackQueueAddress(RepackQueueType::Pending); std::string repackQueueAddress = re.getRepackQueueAddress(common::dataStructures::RepackQueueType::Pending);
cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend); cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend);
repackQueuePending.fetchNoLock(); repackQueuePending.fetchNoLock();
...@@ -3940,7 +3940,7 @@ TEST_P(SchedulerTest, cancelRepackRequest) { ...@@ -3940,7 +3940,7 @@ TEST_P(SchedulerTest, cancelRepackRequest) {
cta::objectstore::RootEntry re(backend); cta::objectstore::RootEntry re(backend);
re.fetchNoLock(); re.fetchNoLock();
std::string repackQueueAddress = re.getRepackQueueAddress(RepackQueueType::Pending); std::string repackQueueAddress = re.getRepackQueueAddress(common::dataStructures::RepackQueueType::Pending);
cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend); cta::objectstore::RepackQueuePending repackQueuePending(repackQueueAddress,backend);
repackQueuePending.fetchNoLock(); repackQueuePending.fetchNoLock();
......
Markdown is supported
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