diff --git a/objectstore/RootEntry.cpp b/objectstore/RootEntry.cpp index f90efdb3bb5c2a1fe22b55061254e479ac05741c..3c9429315178b8dc4271538fb9ea9eb65e682378 100644 --- a/objectstore/RootEntry.cpp +++ b/objectstore/RootEntry.cpp @@ -878,7 +878,7 @@ std::string RootEntry::addOrGetRepackQueueAndCommit(AgentReference& agentRef, Re // Check the repack queue does not already exist try { return getRepackQueueAddress(queueType); - } catch (NoSuchRetrieveQueue &) {} + } catch (NoSuchRepackQueue &) {} // The queue is not there yet. Create it. // Insert the archive queue pointer in the root entry, then the queue. std::string repackQueueNameHeader = "RepackQueue"; diff --git a/objectstore/cta.proto b/objectstore/cta.proto index 9cde1ee0cb214956d0e2da8b8f2e687467099ce6..e26b34b352115f489b86582f980e27d11ea40416 100644 --- a/objectstore/cta.proto +++ b/objectstore/cta.proto @@ -84,12 +84,10 @@ message AgentRegisterPointer { message RepackIndexPointer { required string address = 105; - required EntryLog log = 106; } message RepackQueuePointer { required string address = 107; - required EntryLog log = 108; } diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index 77f25e73d218317f7f29f4ec12dc6ba77b38b682..6d6157f06ac1db1d709c064eb2b7ad3e5eda322c 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -1041,9 +1041,6 @@ void OStoreDB::queueRepack(const std::string& vid, const std::string& bufferURL, rr->setVid(vid); rr->setRepackType(repackType); // Try to reference the object in the index (will fail if there is already a request with this VID. - RootEntry re(m_objectStore); - re.fetchNoLock(); - RepackIndex ri(re.addOrGetRepackIndexAndCommit(*m_agentReference, lc), m_objectStore); try { Helpers::registerRepackRequestToIndex(vid, rr->getAddressIfSet(), *m_agentReference, m_objectStore, lc); } catch (objectstore::RepackIndex::VidAlreadyRegistered &) { @@ -1064,6 +1061,13 @@ void OStoreDB::queueRepack(const std::string& vid, const std::string& bufferURL, } } +//------------------------------------------------------------------------------ +// OStoreDB::queueRepack() +//------------------------------------------------------------------------------ +std::list<common::dataStructures::RepackInfo> OStoreDB::getRepackInfo() { + // TODO + throw exception::Exception("No implemented"); +} //------------------------------------------------------------------------------ // OStoreDB::getDriveStates() diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp index c0de2094d6e6b66e5ed534b015b56288e7573e4b..f6f2018235cd20fb0973f42c8fbfa9447f224c1a 100644 --- a/scheduler/OStoreDB/OStoreDB.hpp +++ b/scheduler/OStoreDB/OStoreDB.hpp @@ -278,6 +278,8 @@ public: void queueRepack(const std::string& vid, const std::string& bufferURL, common::dataStructures::RepackType repackType, log::LogContext &logContext) override; + std::list<common::dataStructures::RepackInfo> getRepackInfo() override; + /* === Drive state handling ============================================== */ /** * Get states of all drives. diff --git a/scheduler/OStoreDB/OStoreDBFactory.hpp b/scheduler/OStoreDB/OStoreDBFactory.hpp index 16d1e53dea1caa78a9467059037009928ad2f3d7..111a3f9a8eb5c01456fbd5cc76b65cd9bbcd614c 100644 --- a/scheduler/OStoreDB/OStoreDBFactory.hpp +++ b/scheduler/OStoreDB/OStoreDBFactory.hpp @@ -156,6 +156,11 @@ public: m_OStoreDB.queueRepack(vid, bufferURL, repackType, lc); } + std::list<common::dataStructures::RepackInfo> getRepackInfo() override { + return m_OStoreDB.getRepackInfo(); + } + + std::list<cta::common::dataStructures::DriveState> getDriveStates(log::LogContext & lc) const override { return m_OStoreDB.getDriveStates(lc); } diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp index d3daeba4e34e9aba683dae866048a51fcb343ba6..83d82fe345999bacdf592871ee77a7a5067f1f20 100644 --- a/scheduler/Scheduler.cpp +++ b/scheduler/Scheduler.cpp @@ -319,14 +319,14 @@ void Scheduler::cancelRepack(const common::dataStructures::SecurityIdentity &cli //------------------------------------------------------------------------------ // getRepacks //------------------------------------------------------------------------------ -std::list<common::dataStructures::RepackInfo> Scheduler::getRepacks(const common::dataStructures::SecurityIdentity &cliIdentity) { - throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); +std::list<common::dataStructures::RepackInfo> Scheduler::getRepacks() { + return m_db.getRepackInfo(); } //------------------------------------------------------------------------------ // getRepack //------------------------------------------------------------------------------ -common::dataStructures::RepackInfo Scheduler::getRepack(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid) { +common::dataStructures::RepackInfo Scheduler::getRepack(const std::string &vid) { throw exception::Exception(std::string("Not implemented: ") + __PRETTY_FUNCTION__); } diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp index 4b18c7a65c58cf5054a2fb01011f01b32cf2f7a5..ec730c41eb9aab1f07aa188fcdd3fa93d6ec2a6a 100644 --- a/scheduler/Scheduler.hpp +++ b/scheduler/Scheduler.hpp @@ -193,10 +193,8 @@ public: void queueRepack(const common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid, const std::string & bufferURL, const common::dataStructures::RepackType repackType, log::LogContext & lc); void cancelRepack(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); - std::list<cta::common::dataStructures::RepackInfo> getRepacks( - const cta::common::dataStructures::SecurityIdentity &cliIdentity); - cta::common::dataStructures::RepackInfo getRepack( - const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &vid); + std::list<cta::common::dataStructures::RepackInfo> getRepacks(); + cta::common::dataStructures::RepackInfo getRepack(const std::string &vid); void shrink(const cta::common::dataStructures::SecurityIdentity &cliIdentity, const std::string &tapepool); // removes extra tape copies from a specific pool(usually an "_2" pool) diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp index a1145991df7d3aee885342d26001b739356eb7f2..fe324342197fd8ec653a0df09cafef3991de16a0 100644 --- a/scheduler/SchedulerDatabase.hpp +++ b/scheduler/SchedulerDatabase.hpp @@ -31,6 +31,7 @@ #include "common/dataStructures/RetrieveJob.hpp" #include "common/dataStructures/RetrieveRequest.hpp" #include "common/dataStructures/RepackType.hpp" +#include "common/dataStructures/RepackInfo.hpp" #include "common/dataStructures/SecurityIdentity.hpp" #include "common/remoteFS/RemotePathAndStatus.hpp" #include "common/log/LogContext.hpp" @@ -355,6 +356,7 @@ public: /*============ Repack management: user side ================================*/ virtual void queueRepack(const std::string & vid, const std::string & bufferURL, common::dataStructures::RepackType repackType, log::LogContext & lc) = 0; + virtual std::list<common::dataStructures::RepackInfo> getRepackInfo() = 0; /*============ Repack management: tape server side =========================*/ diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp index d40421a22e8657b7ead04290fc57af4b50268c6f..22257bb93e013d75f2babad5274be3c138a09271 100644 --- a/scheduler/SchedulerTest.cpp +++ b/scheduler/SchedulerTest.cpp @@ -725,6 +725,22 @@ TEST_P(SchedulerTest, showqueues) { ASSERT_EQ(1, queuesSummary.size()); } +TEST_P(SchedulerTest, repack) { + using namespace cta; + + setupDefaultCatalogue(); + + Scheduler &scheduler = getScheduler(); + + log::DummyLogger dl("", ""); + log::LogContext lc(dl); + + common::dataStructures::SecurityIdentity cliId; + scheduler.queueRepack(cliId, "Tape", "root://server/repackDir", common::dataStructures::RepackType::justrepack, lc); + // TODO + // auto repacks = scheduler.getRepacks(); +} + #undef TEST_MOCK_DB #ifdef TEST_MOCK_DB static cta::MockSchedulerDatabaseFactory mockDbFactory; diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp index 353c7e66a2538ca5b75f3e2199f48430f8695684..d32bab5fd21bab03f09d615fff4223559a979abf 100644 --- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp +++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp @@ -1407,9 +1407,9 @@ void RequestMessage::processRepack_Ls(const cta::admin::AdminCmd &admincmd, cta: std::list<cta::common::dataStructures::RepackInfo> list; if(!vid) { - list = m_scheduler.getRepacks(m_cliIdentity); + list = m_scheduler.getRepacks(); } else { - list.push_back(m_scheduler.getRepack(m_cliIdentity, vid.value())); + list.push_back(m_scheduler.getRepack(vid.value())); } if(!list.empty()) @@ -1459,7 +1459,7 @@ void RequestMessage::processRepack_Err(const cta::admin::AdminCmd &admincmd, cta auto &vid = getRequired(OptionString::VID); - cta::common::dataStructures::RepackInfo info = m_scheduler.getRepack(m_cliIdentity, vid); + cta::common::dataStructures::RepackInfo info = m_scheduler.getRepack(vid); if(!info.errors.empty()) {