Commit 0d76da86 authored by Steven Murray's avatar Steven Murray
Browse files

Revert "rdbms::ConnPool now protects against being configired with a maximum of zero connections"

This reverts commit db9085e6.
parent db9085e6
...@@ -38,7 +38,7 @@ TEST_F(cta_catalogue_InMemoryCatalogue, createSameSchemaInTwoSeparateInMemoryDat ...@@ -38,7 +38,7 @@ TEST_F(cta_catalogue_InMemoryCatalogue, createSameSchemaInTwoSeparateInMemoryDat
log::DummyLogger dummyLog("dummy", "dummy"); log::DummyLogger dummyLog("dummy", "dummy");
const uint64_t nbConns = 1; const uint64_t nbConns = 1;
const uint64_t nbArchiveFileListingConns = 1; const uint64_t nbArchiveFileListingConns = 0;
// First in-memory database // First in-memory database
{ {
...@@ -56,7 +56,7 @@ TEST_F(cta_catalogue_InMemoryCatalogue, schemaTables) { ...@@ -56,7 +56,7 @@ TEST_F(cta_catalogue_InMemoryCatalogue, schemaTables) {
log::DummyLogger dummyLog("dummy", "dummy"); log::DummyLogger dummyLog("dummy", "dummy");
const uint64_t nbConns = 1; const uint64_t nbConns = 1;
const uint64_t nbArchiveFileListingConns = 1; const uint64_t nbArchiveFileListingConns = 0;
catalogue::InMemoryCatalogue inMemoryCatalogue(dummyLog, nbConns, nbArchiveFileListingConns); catalogue::InMemoryCatalogue inMemoryCatalogue(dummyLog, nbConns, nbArchiveFileListingConns);
const auto tableNameList = inMemoryCatalogue.getTableNames(); const auto tableNameList = inMemoryCatalogue.getTableNames();
......
...@@ -33,9 +33,7 @@ namespace rdbms { ...@@ -33,9 +33,7 @@ namespace rdbms {
ConnPool::ConnPool(const Login &login, const uint64_t maxNbConns): ConnPool::ConnPool(const Login &login, const uint64_t maxNbConns):
m_connFactory(wrapper::ConnFactoryFactory::create(login)), m_connFactory(wrapper::ConnFactoryFactory::create(login)),
m_maxNbConns(maxNbConns), m_maxNbConns(maxNbConns),
m_nbConnsOnLoan(0) { m_nbConnsOnLoan(0){
if(0 == m_maxNbConns) throw MaxNbConnsIsZero("Cannot instantiate ConnPool because maxNbConns=0");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#pragma once #pragma once
#include "common/exception/Exception.hpp"
#include "common/threading/CondVar.hpp" #include "common/threading/CondVar.hpp"
#include "common/threading/Mutex.hpp" #include "common/threading/Mutex.hpp"
#include "rdbms/ConnAndStmts.hpp" #include "rdbms/ConnAndStmts.hpp"
...@@ -40,8 +39,6 @@ class Login; ...@@ -40,8 +39,6 @@ class Login;
class ConnPool { class ConnPool {
public: public:
CTA_GENERATE_EXCEPTION_CLASS(MaxNbConnsIsZero);
/** /**
* Constructor. * Constructor.
* *
...@@ -49,7 +46,6 @@ public: ...@@ -49,7 +46,6 @@ public:
* connections. * connections.
* @param maxNbConns The maximum number of database connections within the * @param maxNbConns The maximum number of database connections within the
* pool. * pool.
* @throw MaxNbConnsIsZero if maxNbConns is set to 0.
*/ */
ConnPool(const Login &login, const uint64_t maxNbConns); ConnPool(const Login &login, const uint64_t maxNbConns);
......
...@@ -34,14 +34,6 @@ protected: ...@@ -34,14 +34,6 @@ protected:
} }
}; };
TEST_F(cta_rdbms_ConnPoolTest, MaxNbConnsIsZero) {
using namespace cta::rdbms;
const Login login(Login::DBTYPE_SQLITE, "", "", "file::memory:?cache=shared", "", 0);
const uint64_t nbConns = 0;
ASSERT_THROW(ConnPool pool(login, nbConns), ConnPool::MaxNbConnsIsZero);
}
TEST_F(cta_rdbms_ConnPoolTest, getPooledConn) { TEST_F(cta_rdbms_ConnPoolTest, getPooledConn) {
using namespace cta::rdbms; using namespace cta::rdbms;
......
...@@ -55,7 +55,7 @@ const uint32_t TEST_GROUP_2 = 9754; ...@@ -55,7 +55,7 @@ const uint32_t TEST_GROUP_2 = 9754;
rdbms::Login catalogueLogin(rdbms::Login::DBTYPE_IN_MEMORY, "", "", "", "", 0); rdbms::Login catalogueLogin(rdbms::Login::DBTYPE_IN_MEMORY, "", "", "", "", 0);
const uint64_t nbConns = 1; const uint64_t nbConns = 1;
const uint64_t nbArchiveFileListingConns = 1; const uint64_t nbArchiveFileListingConns = 0;
auto catalogueFactory = CatalogueFactoryFactory::create(m_dummyLog, catalogueLogin, nbConns, auto catalogueFactory = CatalogueFactoryFactory::create(m_dummyLog, catalogueLogin, nbConns,
nbArchiveFileListingConns); nbArchiveFileListingConns);
m_catalogue = catalogueFactory->create(); m_catalogue = catalogueFactory->create();
......
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