Commit f821892f authored by Steven Murray's avatar Steven Murray
Browse files

Added nbConns params to InMemoryCatalogue constructor

parent dbaa6530
...@@ -33,7 +33,7 @@ std::unique_ptr<Catalogue> CatalogueFactory::create(const rdbms::Login &login, c ...@@ -33,7 +33,7 @@ std::unique_ptr<Catalogue> CatalogueFactory::create(const rdbms::Login &login, c
try { try {
switch(login.dbType) { switch(login.dbType) {
case rdbms::Login::DBTYPE_IN_MEMORY: case rdbms::Login::DBTYPE_IN_MEMORY:
return make_unique<InMemoryCatalogue>(); return make_unique<InMemoryCatalogue>(nbConns);
case rdbms::Login::DBTYPE_ORACLE: case rdbms::Login::DBTYPE_ORACLE:
return make_unique<OracleCatalogue>(login.username, login.password, login.database, nbConns); return make_unique<OracleCatalogue>(login.username, login.password, login.database, nbConns);
case rdbms::Login::DBTYPE_SQLITE: case rdbms::Login::DBTYPE_SQLITE:
......
...@@ -54,7 +54,7 @@ void cta_catalogue_CatalogueTest::SetUp() { ...@@ -54,7 +54,7 @@ void cta_catalogue_CatalogueTest::SetUp() {
using namespace cta; using namespace cta;
using namespace cta::catalogue; using namespace cta::catalogue;
const uint64_t nbConns = 2; const uint64_t nbConns = 1;
m_catalogue = CatalogueFactory::create(GetParam()->create(), nbConns); m_catalogue = CatalogueFactory::create(GetParam()->create(), nbConns);
{ {
......
...@@ -27,7 +27,7 @@ namespace catalogue { ...@@ -27,7 +27,7 @@ namespace catalogue {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
InMemoryCatalogue::InMemoryCatalogue(): SchemaCreatingSqliteCatalogue(":memory:", 1) { InMemoryCatalogue::InMemoryCatalogue(const uint64_t nbConns): SchemaCreatingSqliteCatalogue(":memory:", nbConns) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -33,8 +33,10 @@ public: ...@@ -33,8 +33,10 @@ public:
/** /**
* Constructor. * Constructor.
*
* @param nbConns The maximum number of concurrent connections to the underyling database.
*/ */
InMemoryCatalogue(); InMemoryCatalogue(const uint64_t nbConns);
/** /**
* Destructor. * Destructor.
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "common/admin/AdminUser.hpp" #include "common/admin/AdminUser.hpp"
#include "common/admin/AdminHost.hpp" #include "common/admin/AdminHost.hpp"
#include "common/archiveRoutes/ArchiveRoute.hpp" #include "common/archiveRoutes/ArchiveRoute.hpp"
#include "common/make_unique.hpp"
#include "scheduler/ArchiveMount.hpp" #include "scheduler/ArchiveMount.hpp"
#include "scheduler/ArchiveRequest.hpp" #include "scheduler/ArchiveRequest.hpp"
#include "scheduler/LogicalLibrary.hpp" #include "scheduler/LogicalLibrary.hpp"
...@@ -85,9 +86,10 @@ public: ...@@ -85,9 +86,10 @@ public:
const SchedulerTestParam &param = GetParam(); const SchedulerTestParam &param = GetParam();
m_db = param.dbFactory.create(); m_db = param.dbFactory.create();
//m_catalogue.reset(new catalogue::SchemaCreatingSqliteCatalogue(m_tempSqliteFile.path())); const uint64_t nbConns = 1;
m_catalogue.reset(new catalogue::InMemoryCatalogue()); //m_catalogue = make_unique<catalogue::SchemaCreatingSqliteCatalogue>(m_tempSqliteFile.path(), nbConns);
m_scheduler.reset(new cta::Scheduler(*m_catalogue, *m_db, 5, 2*1000*1000)); m_catalogue = make_unique<catalogue::InMemoryCatalogue>(nbConns);
m_scheduler = make_unique<Scheduler>(*m_catalogue, *m_db, 5, 2*1000*1000);
} }
virtual void TearDown() { virtual void TearDown() {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "castor/tape/tapeserver/file/File.hpp" #include "castor/tape/tapeserver/file/File.hpp"
#include "castor/tape/tapeserver/drive/FakeDrive.hpp" #include "castor/tape/tapeserver/drive/FakeDrive.hpp"
#include "common/exception/Exception.hpp" #include "common/exception/Exception.hpp"
#include "common/make_unique.hpp"
#include "common/utils/utils.hpp" #include "common/utils/utils.hpp"
#include "scheduler/Scheduler.hpp" #include "scheduler/Scheduler.hpp"
//#include "smc_struct.h" //#include "smc_struct.h"
...@@ -114,10 +115,10 @@ public: ...@@ -114,10 +115,10 @@ public:
const DataTransferSessionTestParam &param = GetParam(); const DataTransferSessionTestParam &param = GetParam();
m_db = param.dbFactory.create(); m_db = param.dbFactory.create();
//m_catalogue.reset(new catalogue::SchemaCreatingSqliteCatalogue(m_tempSqliteFile.path())); const uint64_t nbConns = 1;
m_catalogue.reset(new catalogue::InMemoryCatalogue()); //m_catalogue = make_unique<catalogue::SchemaCreatingSqliteCatalogue>(m_tempSqliteFile.path(), nbConns);
m_catalogue = make_unique<catalogue::InMemoryCatalogue>(nbConns);
m_scheduler.reset(new cta::Scheduler(*m_catalogue, *m_db, 5, 2*1000*1000)); m_scheduler = make_unique<Scheduler>(*m_catalogue, *m_db, 5, 2*1000*1000);
strncpy(m_tmpDir, "/tmp/DataTransferSessionTestXXXXXX", sizeof(m_tmpDir)); strncpy(m_tmpDir, "/tmp/DataTransferSessionTestXXXXXX", sizeof(m_tmpDir));
if(!mkdtemp(m_tmpDir)) { if(!mkdtemp(m_tmpDir)) {
......
...@@ -43,7 +43,7 @@ namespace unitTests { ...@@ -43,7 +43,7 @@ namespace unitTests {
using namespace cta::catalogue; using namespace cta::catalogue;
rdbms::Login catalogueLogin(rdbms::Login::DBTYPE_IN_MEMORY, "", "", ""); rdbms::Login catalogueLogin(rdbms::Login::DBTYPE_IN_MEMORY, "", "", "");
const uint64_t nbConns = 2; const uint64_t nbConns = 1;
m_catalogue = CatalogueFactory::create(catalogueLogin, nbConns); m_catalogue = CatalogueFactory::create(catalogueLogin, nbConns);
} }
......
...@@ -570,7 +570,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction ...@@ -570,7 +570,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
cta::objectstore::BackendPopulator backendPopulator(*backend); cta::objectstore::BackendPopulator backendPopulator(*backend);
cta::OStoreDBWithAgent osdb(*backend, backendPopulator.getAgent()); cta::OStoreDBWithAgent osdb(*backend, backendPopulator.getAgent());
const cta::rdbms::Login catalogueLogin = cta::rdbms::Login::parseFile("/etc/cta/cta_catalogue_db.conf"); const cta::rdbms::Login catalogueLogin = cta::rdbms::Login::parseFile("/etc/cta/cta_catalogue_db.conf");
const uint64_t nbConns = 2; const uint64_t nbConns = 1;
std::unique_ptr<cta::catalogue::Catalogue> catalogue(cta::catalogue::CatalogueFactory::create(catalogueLogin, nbConns)); std::unique_ptr<cta::catalogue::Catalogue> catalogue(cta::catalogue::CatalogueFactory::create(catalogueLogin, nbConns));
cta::Scheduler 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 cta::Scheduler 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
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "common/archiveRoutes/ArchiveRoute.hpp" #include "common/archiveRoutes/ArchiveRoute.hpp"
#include "common/Configuration.hpp" #include "common/Configuration.hpp"
#include "common/exception/Exception.hpp" #include "common/exception/Exception.hpp"
#include "common/make_unique.hpp"
#include "common/TapePool.hpp" #include "common/TapePool.hpp"
#include "objectstore/RootEntry.hpp" #include "objectstore/RootEntry.hpp"
#include "objectstore/BackendFactory.hpp" #include "objectstore/BackendFactory.hpp"
...@@ -268,10 +269,9 @@ XrdCtaFilesystem::XrdCtaFilesystem(): ...@@ -268,10 +269,9 @@ XrdCtaFilesystem::XrdCtaFilesystem():
} }
const rdbms::Login catalogueLogin = rdbms::Login::parseFile("/etc/cta/cta_catalogue_db.conf"); const rdbms::Login catalogueLogin = rdbms::Login::parseFile("/etc/cta/cta_catalogue_db.conf");
const uint64_t nbConns = 2; const uint64_t nbConns = 1;
m_catalogue = catalogue::CatalogueFactory::create(catalogueLogin, nbConns); m_catalogue = catalogue::CatalogueFactory::create(catalogueLogin, nbConns);
m_scheduler = make_unique<cta::Scheduler>(*m_catalogue, m_scheddb, 5, 2*1000*1000);
m_scheduler.reset(new 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. // If the backend is a VFS, make sure we don't delete it on exit.
// If not, nevermind. // If not, nevermind.
......
Supports Markdown
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