diff --git a/catalogue/Catalogue.cpp b/catalogue/Catalogue.cpp index a0866c30ba3a4f2894d03a13d37c25d1b4c554b3..b958c14715ea9db3cfd5120fc646a7bd485a1536 100644 --- a/catalogue/Catalogue.cpp +++ b/catalogue/Catalogue.cpp @@ -21,6 +21,12 @@ namespace cta { namespace catalogue { +//------------------------------------------------------------------------------ +// constructor +//------------------------------------------------------------------------------ +Catalogue::Catalogue(log::Logger &log): m_log(log) { +} + //------------------------------------------------------------------------------ // destructor //------------------------------------------------------------------------------ diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp index c7d197af3b1bf59a199a665eb817a60dc709f4c0..6525a8ff78882d9d97e93cb588e11a2623fce82b 100644 --- a/catalogue/Catalogue.hpp +++ b/catalogue/Catalogue.hpp @@ -59,6 +59,7 @@ #include "common/dataStructures/VidToTapeMap.hpp" #include "common/dataStructures/WriteTestResult.hpp" #include "common/exception/UserError.hpp" +#include "common/log/Logger.hpp" #include <list> #include <map> @@ -76,6 +77,12 @@ namespace catalogue { */ class Catalogue { public: + /** + * Constructor. + * + * @param log Object representing the API to the CTA logging system. + */ + Catalogue(log::Logger &log); /** * Destructor. @@ -528,6 +535,13 @@ public: */ virtual bool tapeExists(const std::string &vid) const = 0; +private: + + /** + * Object representing the API to the CTA logging system. + */ + log::Logger &m_log; + }; // class Catalogue } // namespace catalogue diff --git a/catalogue/CatalogueFactory.cpp b/catalogue/CatalogueFactory.cpp index 433e34aabfcb027478fcbef840caeafdd7788739..7f16fb1228a589c0d126a1d51bb1cc190eb77fbd 100644 --- a/catalogue/CatalogueFactory.cpp +++ b/catalogue/CatalogueFactory.cpp @@ -29,17 +29,20 @@ namespace catalogue { //------------------------------------------------------------------------------ // create //------------------------------------------------------------------------------ -std::unique_ptr<Catalogue> CatalogueFactory::create(const rdbms::Login &login, const uint64_t nbConns, +std::unique_ptr<Catalogue> CatalogueFactory::create( + log::Logger &log, + const rdbms::Login &login, + const uint64_t nbConns, const uint64_t nbArchiveFileListingConns) { try { switch(login.dbType) { case rdbms::Login::DBTYPE_IN_MEMORY: - return cta::make_unique<InMemoryCatalogue>(nbConns, nbArchiveFileListingConns); + return cta::make_unique<InMemoryCatalogue>(log, nbConns, nbArchiveFileListingConns); case rdbms::Login::DBTYPE_ORACLE: - return cta::make_unique<OracleCatalogue>(login.username, login.password, login.database, nbConns, + return cta::make_unique<OracleCatalogue>(log, login.username, login.password, login.database, nbConns, nbArchiveFileListingConns); case rdbms::Login::DBTYPE_SQLITE: - return cta::make_unique<SqliteCatalogue>(login.database, nbConns, nbArchiveFileListingConns); + return cta::make_unique<SqliteCatalogue>(log, login.database, nbConns, nbArchiveFileListingConns); case rdbms::Login::DBTYPE_NONE: throw exception::Exception("Cannot create a catalogue without a database type"); default: diff --git a/catalogue/CatalogueFactory.hpp b/catalogue/CatalogueFactory.hpp index 3aa64ee8a9b8bfeff029c4b099c779edc93ff2ec..d76d19461b68cc181f8ba81d70c9590cf9aa47e7 100644 --- a/catalogue/CatalogueFactory.hpp +++ b/catalogue/CatalogueFactory.hpp @@ -41,6 +41,7 @@ public: /** * Creates a CTA catalogue object using the specified database login details. * + * @param log Object representing the API to the CTA logging system. * @param login The database connection details. * @param nbConns The maximum number of concurrent connections to the * underlying relational database for all operations accept listing archive @@ -51,7 +52,10 @@ public: * @return The newly created CTA catalogue object. Please note that it is the * responsibility of the caller to delete the returned CTA catalogue object. */ - static std::unique_ptr<Catalogue> create(const rdbms::Login &login, const uint64_t nbConns, + static std::unique_ptr<Catalogue> create( + log::Logger &log, + const rdbms::Login &login, + const uint64_t nbConns, const uint64_t nbArchiveFileListingConns); }; // class CatalogueFactory diff --git a/catalogue/CatalogueFactoryTest.cpp b/catalogue/CatalogueFactoryTest.cpp index 4b6f7d70549ccb8b1d67ea605c2350064a2f5fa5..04d39e778220fffb95619e9455ab512ee4a32006 100644 --- a/catalogue/CatalogueFactoryTest.cpp +++ b/catalogue/CatalogueFactoryTest.cpp @@ -19,6 +19,7 @@ #include "catalogue/ArchiveFileRow.hpp" #include "catalogue/CatalogueFactory.hpp" #include "common/exception/Exception.hpp" +#include "common/log/DummyLogger.hpp" #include <gtest/gtest.h> #include <memory> @@ -27,7 +28,8 @@ namespace unitTests { class cta_catalogue_CatalogueFactoryTest : public ::testing::Test { public: - cta_catalogue_CatalogueFactoryTest() { + cta_catalogue_CatalogueFactoryTest(): + m_dummyLog("dummy") { m_localAdmin.username = "local_admin_user"; m_localAdmin.host = "local_admin_host"; @@ -43,6 +45,7 @@ protected: virtual void TearDown() { } + cta::log::DummyLogger m_dummyLog; cta::common::dataStructures::SecurityIdentity m_localAdmin; cta::common::dataStructures::SecurityIdentity m_admin; }; @@ -54,7 +57,7 @@ TEST_F(cta_catalogue_CatalogueFactoryTest, instance_in_memory) { rdbms::Login login(rdbms::Login::DBTYPE_IN_MEMORY, "", "", ""); const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 1; - std::unique_ptr<Catalogue> catalogue(CatalogueFactory::create(login, nbConns, nbArchiveFileListingConns)); + std::unique_ptr<Catalogue> catalogue(CatalogueFactory::create(m_dummyLog, login, nbConns, nbArchiveFileListingConns)); ASSERT_TRUE(nullptr != catalogue.get()); ASSERT_TRUE(catalogue->getAdminUsers().empty()); diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp index 5d0d7f5aa15bca8e9cf0f629bfd08428275f7476..ee176a84619270d7a223ee00f5332c705d282bc4 100644 --- a/catalogue/CatalogueTest.cpp +++ b/catalogue/CatalogueTest.cpp @@ -35,7 +35,8 @@ namespace unitTests { //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -cta_catalogue_CatalogueTest::cta_catalogue_CatalogueTest() { +cta_catalogue_CatalogueTest::cta_catalogue_CatalogueTest(): + m_dummyLog("dummy") { m_localAdmin.username = "local_admin_user"; m_localAdmin.host = "local_admin_host"; @@ -56,7 +57,7 @@ void cta_catalogue_CatalogueTest::SetUp() { const uint64_t nbConns = 2; const uint64_t nbArchiveFileListingConns = 2; - m_catalogue = CatalogueFactory::create(login, nbConns, nbArchiveFileListingConns); + m_catalogue = CatalogueFactory::create(m_dummyLog, login, nbConns, nbArchiveFileListingConns); m_conn = connFactory->create(); { diff --git a/catalogue/CatalogueTest.hpp b/catalogue/CatalogueTest.hpp index 5ef2601ca5857c1bc8c964814895c52253c3321c..2b9fcf6e2f2abbcf67e028d694ac41be617b3ba5 100644 --- a/catalogue/CatalogueTest.hpp +++ b/catalogue/CatalogueTest.hpp @@ -21,6 +21,7 @@ #include "catalogue/ArchiveFileRow.hpp" #include "catalogue/CatalogueFactory.hpp" #include "common/exception/Exception.hpp" +#include "common/log/DummyLogger.hpp" #include "rdbms/Conn.hpp" #include "rdbms/LoginFactory.hpp" @@ -38,6 +39,7 @@ public: protected: + cta::log::DummyLogger m_dummyLog; std::unique_ptr<cta::catalogue::Catalogue> m_catalogue; cta::common::dataStructures::SecurityIdentity m_localAdmin; cta::common::dataStructures::SecurityIdentity m_admin; diff --git a/catalogue/CreateAdminHostCmd.cpp b/catalogue/CreateAdminHostCmd.cpp index cd00c002a5a99e880df6ba1b6fada85bcca96c5b..aad0551c81ce48b221577d4598ddebd673bfe19d 100644 --- a/catalogue/CreateAdminHostCmd.cpp +++ b/catalogue/CreateAdminHostCmd.cpp @@ -20,6 +20,7 @@ #include "catalogue/CreateAdminHostCmd.hpp" #include "catalogue/CreateAdminHostCmdLineArgs.hpp" #include "common/exception/Exception.hpp" +#include "common/log/DummyLogger.hpp" #include "rdbms/ConnFactoryFactory.hpp" namespace cta { @@ -55,7 +56,8 @@ int CreateAdminHostCmd::exceptionThrowingMain(const int argc, char *const *const const rdbms::Login dbLogin = rdbms::Login::parseFile(cmdLineArgs.dbConfigPath); const uint64_t nbDbConns = 1; const uint64_t nbArchiveFileListingDbConns = 0; - auto catalogue = CatalogueFactory::create(dbLogin, nbDbConns, nbArchiveFileListingDbConns); + log::DummyLogger dummyLog("dummy"); + auto catalogue = CatalogueFactory::create(dummyLog, dbLogin, nbDbConns, nbArchiveFileListingDbConns); const common::dataStructures::SecurityIdentity adminRunningCommand(getUsername(), getHostname()); catalogue->createAdminHost(adminRunningCommand, cmdLineArgs.adminHostname, cmdLineArgs.comment); diff --git a/catalogue/CreateAdminUserCmd.cpp b/catalogue/CreateAdminUserCmd.cpp index 53da5621812b8995bb376d54d8bd66f14a8e492e..8bc5d1c98920520207b21956a48d9644b5baceb1 100644 --- a/catalogue/CreateAdminUserCmd.cpp +++ b/catalogue/CreateAdminUserCmd.cpp @@ -20,6 +20,7 @@ #include "catalogue/CreateAdminUserCmd.hpp" #include "catalogue/CreateAdminUserCmdLineArgs.hpp" #include "common/exception/Exception.hpp" +#include "common/log/DummyLogger.hpp" #include "rdbms/ConnFactoryFactory.hpp" namespace cta { @@ -55,7 +56,8 @@ int CreateAdminUserCmd::exceptionThrowingMain(const int argc, char *const *const const rdbms::Login dbLogin = rdbms::Login::parseFile(cmdLineArgs.dbConfigPath); const uint64_t nbDbConns = 1; const uint64_t nbArchiveFileListingDbConns = 1; - auto catalogue = CatalogueFactory::create(dbLogin, nbDbConns, nbArchiveFileListingDbConns); + log::DummyLogger dummyLog("dummy"); + auto catalogue = CatalogueFactory::create(dummyLog, dbLogin, nbDbConns, nbArchiveFileListingDbConns); const common::dataStructures::SecurityIdentity adminRunningCommand(getUsername(), getHostname()); catalogue->createAdminUser(adminRunningCommand, cmdLineArgs.adminUsername, cmdLineArgs.comment); diff --git a/catalogue/InMemoryCatalogue.cpp b/catalogue/InMemoryCatalogue.cpp index 3df1057109504c07b00a65b6d94a446792c070b5..a88201c16d9fd366da2037168523da84126072df 100644 --- a/catalogue/InMemoryCatalogue.cpp +++ b/catalogue/InMemoryCatalogue.cpp @@ -27,8 +27,11 @@ namespace catalogue { //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -InMemoryCatalogue::InMemoryCatalogue(const uint64_t nbConns, const uint64_t nbArchiveFileListingConns): - SchemaCreatingSqliteCatalogue("file::memory:?cache=shared", nbConns, nbArchiveFileListingConns) { +InMemoryCatalogue::InMemoryCatalogue( + log::Logger &log, + const uint64_t nbConns, + const uint64_t nbArchiveFileListingConns): + SchemaCreatingSqliteCatalogue(log, "file::memory:?cache=shared", nbConns, nbArchiveFileListingConns) { } //------------------------------------------------------------------------------ diff --git a/catalogue/InMemoryCatalogue.hpp b/catalogue/InMemoryCatalogue.hpp index 108128af2376f1ef2fa4d6b54495590b906fb742..6605647dcbc0cde497d75e1ff22c2a29f4a04bdc 100644 --- a/catalogue/InMemoryCatalogue.hpp +++ b/catalogue/InMemoryCatalogue.hpp @@ -34,6 +34,7 @@ public: /** * Constructor. * + * @param log Object representing the API to the CTA logging system. * @param nbConns The maximum number of concurrent connections to the * underlying relational database for all operations accept listing archive * files which can be relatively long operations. @@ -41,7 +42,10 @@ public: * connections to the underlying relational database for the sole purpose of * listing archive files. */ - InMemoryCatalogue(const uint64_t nbConns, const uint64_t nbArchiveFileListingConns); + InMemoryCatalogue( + log::Logger &log, + const uint64_t nbConns, + const uint64_t nbArchiveFileListingConns); /** * Destructor. diff --git a/catalogue/OracleCatalogue.cpp b/catalogue/OracleCatalogue.cpp index 005861572a7c04c8aa3d99fc5ee93542eb5882de..a252f6dd46e608db84177d9f67abf86bdec2e3a3 100644 --- a/catalogue/OracleCatalogue.cpp +++ b/catalogue/OracleCatalogue.cpp @@ -36,14 +36,17 @@ namespace catalogue { // constructor //------------------------------------------------------------------------------ OracleCatalogue::OracleCatalogue( + log::Logger &log, const std::string &username, const std::string &password, const std::string &database, const uint64_t nbConns, const uint64_t nbArchiveFileListingConns): RdbmsCatalogue( + log, rdbms::ConnFactoryFactory::create(rdbms::Login(rdbms::Login::DBTYPE_ORACLE, username, password, database)), - nbConns, nbArchiveFileListingConns) { + nbConns, + nbArchiveFileListingConns) { } diff --git a/catalogue/OracleCatalogue.hpp b/catalogue/OracleCatalogue.hpp index d4bdfc1c121c6059fd5cae3ed067941826617ad0..ea7891e1135e104eba4b027ea90cd8ecf6b057f7 100644 --- a/catalogue/OracleCatalogue.hpp +++ b/catalogue/OracleCatalogue.hpp @@ -39,6 +39,7 @@ public: /** * Constructor. * + * @param log Object representing the API to the CTA logging system. * @param username The database username. * @param password The database password. * @param database The database name. @@ -50,6 +51,7 @@ public: * listing archive files. */ OracleCatalogue( + log::Logger &log, const std::string &username, const std::string &password, const std::string &database, diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 322198979dc5ce005657d631e7b9c46d0a725136..6becf607e6a25677d8907db39083446bf6998570 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -39,9 +39,11 @@ namespace catalogue { // constructor //------------------------------------------------------------------------------ RdbmsCatalogue::RdbmsCatalogue( + log::Logger &log, std::unique_ptr<rdbms::ConnFactory> connFactory, const uint64_t nbConns, const uint64_t nbArchiveFileListingConns): + Catalogue(log), m_connFactory(std::move(connFactory)), m_connPool(*m_connFactory, nbConns), m_archiveFileListingConnPool(*m_connFactory, nbArchiveFileListingConns) { diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp index 49791a02357ce33bd82cd38cc97fdf02efcc3d8d..7868dbcf0ff06bffbab25f2be347bb46102e919e 100644 --- a/catalogue/RdbmsCatalogue.hpp +++ b/catalogue/RdbmsCatalogue.hpp @@ -61,6 +61,7 @@ protected: /** * Protected constructor only to be called by sub-classes. * + * @param log Object representing the API to the CTA logging system. * @param connFactory The factory for creating new database connections. * @param nbConns The maximum number of concurrent connections to the * underlying relational database for all operations accept listing archive @@ -69,7 +70,10 @@ protected: * connections to the underlying relational database for the sole purpose of * listing archive files. */ - RdbmsCatalogue(std::unique_ptr<rdbms::ConnFactory> connFactory, const uint64_t nbConns, + RdbmsCatalogue( + log::Logger &log, + std::unique_ptr<rdbms::ConnFactory> connFactory, + const uint64_t nbConns, const uint64_t nbArchiveFileListingConns); public: diff --git a/catalogue/SchemaCreatingSqliteCatalogue.cpp b/catalogue/SchemaCreatingSqliteCatalogue.cpp index 0470f133fa3cd8bdc79d57db175b892fad1c3a79..1f3d9ef0aa9334a46f682050b2766c0bbe4ba90e 100644 --- a/catalogue/SchemaCreatingSqliteCatalogue.cpp +++ b/catalogue/SchemaCreatingSqliteCatalogue.cpp @@ -28,10 +28,11 @@ namespace catalogue { // constructor //------------------------------------------------------------------------------ SchemaCreatingSqliteCatalogue::SchemaCreatingSqliteCatalogue( + log::Logger &log, const std::string &filename, const uint64_t nbConns, const uint64_t nbArchiveFileListingConns): - SqliteCatalogue(filename, nbConns, nbArchiveFileListingConns) { + SqliteCatalogue(log, filename, nbConns, nbArchiveFileListingConns) { try { createCatalogueSchema(); } catch(exception::Exception &ex) { diff --git a/catalogue/SchemaCreatingSqliteCatalogue.hpp b/catalogue/SchemaCreatingSqliteCatalogue.hpp index 3a5585b1d973397d7a3a5dc35af75e36028a4a27..fe265c3932deb6fb38d00a91ba58f33e23c9b368 100644 --- a/catalogue/SchemaCreatingSqliteCatalogue.hpp +++ b/catalogue/SchemaCreatingSqliteCatalogue.hpp @@ -34,6 +34,7 @@ public: /** * Constructor. * + * @param log Object representing the API to the CTA logging system. * @param filename The filename to be passed to the sqlite3_open() function. * @param nbConns The maximum number of concurrent connections to the * underlying relational database for all operations accept listing archive @@ -42,7 +43,10 @@ public: * connections to the underlying relational database for the sole purpose of * listing archive files. */ - SchemaCreatingSqliteCatalogue(const std::string &filename, const uint64_t nbConns, + SchemaCreatingSqliteCatalogue( + log::Logger &log, + const std::string &filename, + const uint64_t nbConns, const uint64_t nbArchiveFileListingConns); /** diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp index d60e433d13e1b25136f1ea2e3c82fc200fed14eb..914b5b84e9a44239333d8d0daa2cd1b566c1ac38 100644 --- a/catalogue/SqliteCatalogue.cpp +++ b/catalogue/SqliteCatalogue.cpp @@ -33,9 +33,13 @@ namespace catalogue { //------------------------------------------------------------------------------ // constructor //------------------------------------------------------------------------------ -SqliteCatalogue::SqliteCatalogue(const std::string &filename, const uint64_t nbConns, +SqliteCatalogue::SqliteCatalogue( + log::Logger &log, + const std::string &filename, + const uint64_t nbConns, const uint64_t nbArchiveFileListingConns): RdbmsCatalogue( + log, rdbms::ConnFactoryFactory::create(rdbms::Login(rdbms::Login::DBTYPE_SQLITE, "", "", filename)), nbConns, nbArchiveFileListingConns) { diff --git a/catalogue/SqliteCatalogue.hpp b/catalogue/SqliteCatalogue.hpp index 35bf1b8e034a5425a293ba4ea0499b254c67d0ce..9a3f4f3ca673cd293b6b9b168fda8385a8311f01 100644 --- a/catalogue/SqliteCatalogue.hpp +++ b/catalogue/SqliteCatalogue.hpp @@ -34,6 +34,7 @@ public: /** * Constructor. * + * @param log Object representing the API to the CTA logging system. * @param filename The filename to be passed to the sqlite3_open() function. * @param nbConns The maximum number of concurrent connections to the * underlying relational database for all operations accept listing archive @@ -42,7 +43,10 @@ public: * connections to the underlying relational database for the sole purpose of * listing archive files. */ - SqliteCatalogue(const std::string &filename, const uint64_t nbConns, + SqliteCatalogue( + log::Logger &log, + const std::string &filename, + const uint64_t nbConns, const uint64_t nbArchiveFileListingConns); public: diff --git a/common/log/DummyLogger.hpp b/common/log/DummyLogger.hpp index d7f5d967bf703107bd6c5d29c966e95237d496a6..2e25e604f06c18cd2a2b3dd38a0ef5d193c46350 100644 --- a/common/log/DummyLogger.hpp +++ b/common/log/DummyLogger.hpp @@ -24,7 +24,7 @@ namespace cta { namespace log { /** - * A dummy logger class whose implementation of the API of the CASTOR logging + * A dummy logger class whose implementation of the API of the CTA logging * system does nothing. * * The primary purpose of this class is to facilitate the unit testing of diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp index 295849ca56d2a0419693b67f8ea5f57306c4118e..e78123e1ecce369e6b1dcc97f69d8adf30fb91c4 100644 --- a/scheduler/SchedulerTest.cpp +++ b/scheduler/SchedulerTest.cpp @@ -21,6 +21,7 @@ #include "common/admin/AdminUser.hpp" #include "common/admin/AdminHost.hpp" #include "common/archiveRoutes/ArchiveRoute.hpp" +#include "common/log/DummyLogger.hpp" #include "common/make_unique.hpp" #include "scheduler/ArchiveMount.hpp" #include "scheduler/LogicalLibrary.hpp" @@ -69,7 +70,7 @@ struct SchedulerTestParam { class SchedulerTest: public ::testing::TestWithParam<SchedulerTestParam> { public: - SchedulerTest() { + SchedulerTest(): m_dummyLog("dummy") { } class FailedToGetCatalogue: public std::exception { @@ -101,7 +102,7 @@ public: const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 1; //m_catalogue = cta::make_unique<catalogue::SchemaCreatingSqliteCatalogue>(m_tempSqliteFile.path(), nbConns); - m_catalogue = cta::make_unique<catalogue::InMemoryCatalogue>(nbConns, nbArchiveFileListingConns); + m_catalogue = cta::make_unique<catalogue::InMemoryCatalogue>(m_dummyLog, nbConns, nbArchiveFileListingConns); m_scheduler = cta::make_unique<Scheduler>(*m_catalogue, *m_db, 5, 2*1000*1000); } @@ -212,6 +213,7 @@ private: // Prevent assignment SchedulerTest & operator= (const SchedulerTest &) = delete; + cta::log::DummyLogger m_dummyLog; std::unique_ptr<cta::SchedulerDatabase> m_db; std::unique_ptr<cta::catalogue::Catalogue> m_catalogue; std::unique_ptr<cta::Scheduler> m_scheduler; diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp index af30af042dd810132110ab7275091daf936efafa..2b345975d8b76c17ac642d37f18f8466ac15783a 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp @@ -92,7 +92,9 @@ struct DataTransferSessionTestParam { class DataTransferSessionTest: public ::testing::TestWithParam<DataTransferSessionTestParam> { public: - DataTransferSessionTest() { } + DataTransferSessionTest(): + m_dummyLog("dummy"){ + } class FailedToGetCatalogue: public std::exception { @@ -117,7 +119,7 @@ public: const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 1; //m_catalogue = cta::make_unique<catalogue::SchemaCreatingSqliteCatalogue>(m_tempSqliteFile.path(), nbConns); - m_catalogue = cta::make_unique<catalogue::InMemoryCatalogue>(nbConns, nbArchiveFileListingConns); + m_catalogue = cta::make_unique<catalogue::InMemoryCatalogue>(m_dummyLog, nbConns, nbArchiveFileListingConns); m_scheduler = cta::make_unique<Scheduler>(*m_catalogue, *m_db, 5, 2*1000*1000); strncpy(m_tmpDir, "/tmp/DataTransferSessionTestXXXXXX", sizeof(m_tmpDir)); @@ -285,6 +287,8 @@ private: std::unique_ptr<cta::Scheduler> m_scheduler; protected: + cta::log::DummyLogger m_dummyLog; + // Default parameters for storage classes, etc... const std::string s_userName = "user_name"; const std::string s_diskInstance = "disk_instance"; diff --git a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp index e7b1ccec45dcb921ef53e34c304fb720a41deb56..497cef0021a755f571f67d85885afc6cb8fb41c1 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp @@ -21,6 +21,7 @@ * @author Castor Dev team, castor-dev@cern.ch *****************************************************************************/ +#include "common/log/DummyLogger.hpp" #include "common/log/StringLogger.hpp" #include "castor/tape/tapeserver/daemon/MigrationReportPacker.hpp" #include "castor/tape/tapeserver/drive/DriveInterface.hpp" @@ -36,6 +37,11 @@ using namespace castor::tape; namespace unitTests { class castor_tape_tapeserver_daemon_MigrationReportPackerTest: public ::testing::Test { + public: + castor_tape_tapeserver_daemon_MigrationReportPackerTest(): + m_dummyLog("dummy") { + } + protected: void SetUp() { @@ -45,13 +51,14 @@ namespace unitTests { rdbms::Login catalogueLogin(rdbms::Login::DBTYPE_IN_MEMORY, "", "", ""); const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 0; - m_catalogue = CatalogueFactory::create(catalogueLogin, nbConns, nbArchiveFileListingConns); + m_catalogue = CatalogueFactory::create(m_dummyLog, catalogueLogin, nbConns, nbArchiveFileListingConns); } void TearDown() { m_catalogue.reset(); } + cta::log::DummyLogger m_dummyLog; std::unique_ptr<cta::catalogue::Catalogue> m_catalogue; }; // class castor_tape_tapeserver_daemon_MigrationReportPackerTest diff --git a/tapeserver/daemon/DriveHandler.cpp b/tapeserver/daemon/DriveHandler.cpp index e0900373350503afd9ed093defd9fda8224ba849..9fcc9b367e12e8c9180ed168c55022e74dfa4a5d 100644 --- a/tapeserver/daemon/DriveHandler.cpp +++ b/tapeserver/daemon/DriveHandler.cpp @@ -884,7 +884,7 @@ int DriveHandler::runChild() { const cta::rdbms::Login catalogueLogin = cta::rdbms::Login::parseFile(m_tapedConfig.fileCatalogConfigFile.value()); const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 0; - catalogue=cta::catalogue::CatalogueFactory::create(catalogueLogin, nbConns, nbArchiveFileListingConns); + catalogue=cta::catalogue::CatalogueFactory::create(m_sessionEndContext.logger(), catalogueLogin, nbConns, nbArchiveFileListingConns); } catch(cta::exception::Exception &ex) { log::ScopedParamContainer param(m_processManager.logContext()); param.add("errorMessage", ex.getMessageValue()); diff --git a/tapeserver/daemon/DriveHandler.hpp b/tapeserver/daemon/DriveHandler.hpp index 4d1ee06a3cc1bef3cd7ccc13aa1d232de5e85eb7..628ea0a0fa63a3ec20c0ac15f03b4c870315502d 100644 --- a/tapeserver/daemon/DriveHandler.hpp +++ b/tapeserver/daemon/DriveHandler.hpp @@ -140,4 +140,4 @@ private: // TODO: remove/merge ChildProcess. -}}} // namespace cta::tape::daemon \ No newline at end of file +}}} // namespace cta::tape::daemon diff --git a/tapeserver/daemon/GarbageCollectorHandler.cpp b/tapeserver/daemon/GarbageCollectorHandler.cpp index b5178bb301dfcec87117b5d2af4b6412de17b2e0..b65e90a9696e2dee1b5be60996ce4d4307b809cc 100644 --- a/tapeserver/daemon/GarbageCollectorHandler.cpp +++ b/tapeserver/daemon/GarbageCollectorHandler.cpp @@ -272,7 +272,7 @@ int GarbageCollectorHandler::runChild() { const cta::rdbms::Login catalogueLogin = cta::rdbms::Login::parseFile(m_tapedConfig.fileCatalogConfigFile.value()); const uint64_t nbConns = 1; const uint64_t nbArchiveFileListingConns = 0; - catalogue=cta::catalogue::CatalogueFactory::create(catalogueLogin, nbConns, nbArchiveFileListingConns); + catalogue=cta::catalogue::CatalogueFactory::create(m_processManager.logContext().logger(), catalogueLogin, nbConns, nbArchiveFileListingConns); scheduler=make_unique<cta::Scheduler>(*catalogue, *osdb, 5, 2*1000*1000); //TODO: we have hardcoded the mount policy parameters here temporarily we will remove them once we know where to put them // Before launching the transfer session, we validate that the scheduler is reachable. scheduler->ping(); diff --git a/xroot_plugins/XrdCtaFilesystem.cpp b/xroot_plugins/XrdCtaFilesystem.cpp index 4c3fa317e0b5514da6586bcbbec822fed490f0c0..e7b46e98def0a7ad4434079f03bbf3114145aa7c 100644 --- a/xroot_plugins/XrdCtaFilesystem.cpp +++ b/xroot_plugins/XrdCtaFilesystem.cpp @@ -543,7 +543,7 @@ XrdCtaFilesystem::XrdCtaFilesystem(): const rdbms::Login catalogueLogin = rdbms::Login::parseFile("/etc/cta/cta_catalogue_db.conf"); const uint64_t nbConns = m_ctaConf.getConfEntInt<uint64_t>("Catalogue", "NumberOfConnections", nullptr); const uint64_t nbArchiveFileListingConns = 2; - m_catalogue = catalogue::CatalogueFactory::create(catalogueLogin, nbConns, nbArchiveFileListingConns); + m_catalogue = catalogue::CatalogueFactory::create(*m_log, catalogueLogin, nbConns, nbArchiveFileListingConns); m_scheduler = cta::make_unique<cta::Scheduler>(*m_catalogue, m_scheddb, 5, 2*1000*1000); // If the backend is a VFS, make sure we don't delete it on exit.