mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[#3710] removed code
This commit is contained in:
@@ -271,7 +271,7 @@ RotatingFile::useExistingFiles(struct tm& time_info) {
|
||||
}
|
||||
|
||||
void
|
||||
RotatingFile::open(ManagerID) {
|
||||
RotatingFile::open() {
|
||||
if (isOpen() || MultiThreadingMgr::instance().isTestMode()) {
|
||||
return;
|
||||
}
|
||||
|
@@ -135,10 +135,8 @@ public:
|
||||
/// it is created. If the file is already open, the method simply
|
||||
/// returns.
|
||||
///
|
||||
/// @param id the forensic backend manager ID.
|
||||
///
|
||||
/// @throw LegalLogMgrError if the file cannot be opened.
|
||||
virtual void open(isc::dhcp::ManagerID id = 0);
|
||||
virtual void open();
|
||||
|
||||
/// @brief Closes the underlying file.
|
||||
///
|
||||
|
@@ -280,16 +280,13 @@ MySqlStore::MySqlStore(const DatabaseConnection::ParameterMap& parameters)
|
||||
timer_name_ += "]DbReconnectTimer";
|
||||
}
|
||||
|
||||
void MySqlStore::open(ManagerID id) {
|
||||
void MySqlStore::open() {
|
||||
LegalLogDbLogger pushed(mysql_legal_log_db_logger);
|
||||
|
||||
// Test schema version first.
|
||||
std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
|
||||
MYSQL_SCHEMA_VERSION_MINOR);
|
||||
|
||||
LegalLogMgrPtr store = LegalLogMgrFactory::instance(id);
|
||||
LegalLogMgrFactory::instance(id).reset();
|
||||
|
||||
string timer_name;
|
||||
bool retry = false;
|
||||
if (LegalLogMgr::getParameters().count("retry-on-startup")) {
|
||||
@@ -310,8 +307,6 @@ void MySqlStore::open(ManagerID id) {
|
||||
<< db_version.second);
|
||||
}
|
||||
|
||||
LegalLogMgrFactory::instance(id) = store;
|
||||
|
||||
// Create an initial context.
|
||||
pool_.reset(new MySqlStoreContextPool());
|
||||
pool_->pool_.push_back(createContext());
|
||||
|
@@ -136,12 +136,10 @@ public:
|
||||
///
|
||||
/// Finally, all the SQL commands are pre-compiled.
|
||||
///
|
||||
/// @param id the forensic backend manager ID.
|
||||
///
|
||||
/// @throw isc::db::DbOpenError Error opening the database
|
||||
/// @throw isc::db::DbOperationError An operation on the open
|
||||
/// database has failed.
|
||||
virtual void open(ManagerID id = 0);
|
||||
virtual void open();
|
||||
|
||||
/// @brief Closes the store.
|
||||
virtual void close();
|
||||
|
@@ -589,10 +589,7 @@ MySqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndRecoveredCallback() {
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -633,10 +630,7 @@ MySqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndFailedCallback() {
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -677,10 +671,7 @@ MySqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndRecoveredAfterTimeoutCall
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -749,10 +740,7 @@ MySqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndFailedAfterTimeoutCallbac
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -808,10 +796,7 @@ MySqlLegalLogDbLostCallbackTest::testNoCallbackOnOpenFailure() {
|
||||
// Verify that a MySqlStore with no database name is rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(invalidConnectString());
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenError);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenError);
|
||||
|
||||
io_service_->poll();
|
||||
|
||||
@@ -846,11 +831,7 @@ MySqlLegalLogDbLostCallbackTest::testDbLostAndRecoveredCallback() {
|
||||
// Verify that a MySqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(validConnectString());
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
LegalLogMgrFactory::setParameters(params);
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
@@ -904,10 +885,7 @@ MySqlLegalLogDbLostCallbackTest::testDbLostAndFailedCallback() {
|
||||
// Verify that a MySqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(validConnectString());
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
@@ -968,11 +946,7 @@ MySqlLegalLogDbLostCallbackTest::testDbLostAndRecoveredAfterTimeoutCallback() {
|
||||
// Verify that a MySqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(access);
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
LegalLogMgrFactory::setParameters(params);
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
@@ -1062,10 +1036,7 @@ MySqlLegalLogDbLostCallbackTest::testDbLostAndFailedAfterTimeoutCallback() {
|
||||
// Verify that a MySqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(access);
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new MySqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
|
@@ -177,7 +177,7 @@ PgSqlStore::PgSqlStore(const DatabaseConnection::ParameterMap& parameters)
|
||||
timer_name_ += "]DbReconnectTimer";
|
||||
}
|
||||
|
||||
void PgSqlStore::open(ManagerID id) {
|
||||
void PgSqlStore::open() {
|
||||
LegalLogDbLogger pushed(pgsql_legal_log_db_logger);
|
||||
|
||||
// Check TLS support.
|
||||
@@ -207,9 +207,6 @@ void PgSqlStore::open(ManagerID id) {
|
||||
pair<uint32_t, uint32_t> code_version(PGSQL_SCHEMA_VERSION_MAJOR,
|
||||
PGSQL_SCHEMA_VERSION_MINOR);
|
||||
|
||||
LegalLogMgrPtr store = LegalLogMgrFactory::instance(id);
|
||||
LegalLogMgrFactory::instance(id).reset();
|
||||
|
||||
string timer_name;
|
||||
bool retry = false;
|
||||
if (LegalLogMgr::getParameters().count("retry-on-startup")) {
|
||||
@@ -230,8 +227,6 @@ void PgSqlStore::open(ManagerID id) {
|
||||
<< db_version.second);
|
||||
}
|
||||
|
||||
LegalLogMgrFactory::instance(id) = store;
|
||||
|
||||
// Create an initial context.
|
||||
pool_.reset(new PgSqlStoreContextPool());
|
||||
pool_->pool_.push_back(createContext());
|
||||
|
@@ -131,12 +131,10 @@ public:
|
||||
///
|
||||
/// Finally, all the SQL commands are pre-compiled.
|
||||
///
|
||||
/// @param id the forensic backend manager ID.
|
||||
///
|
||||
/// @throw isc::db::DbOpenError Error opening the database
|
||||
/// @throw isc::db::DbOperationError An operation on the open
|
||||
/// database has failed.
|
||||
virtual void open(ManagerID id = 0);
|
||||
virtual void open();
|
||||
|
||||
/// @brief Closes the store.
|
||||
virtual void close();
|
||||
|
@@ -506,10 +506,7 @@ PgSqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndRecoveredCallback() {
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -550,10 +547,7 @@ PgSqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndFailedCallback() {
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -594,10 +588,7 @@ PgSqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndRecoveredAfterTimeoutCall
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -666,10 +657,7 @@ PgSqlLegalLogDbLostCallbackTest::testRetryOpenDbLostAndFailedAfterTimeoutCallbac
|
||||
std::shared_ptr<DbConnectionInitWithRetry> dbr(new DbConnectionInitWithRetry());
|
||||
params.emplace("retry-on-startup", "true");
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenErrorWithRetry);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenErrorWithRetry);
|
||||
|
||||
// Verify there is no instance.
|
||||
ASSERT_FALSE(LegalLogMgrFactory::instance());
|
||||
@@ -725,10 +713,7 @@ PgSqlLegalLogDbLostCallbackTest::testNoCallbackOnOpenFailure() {
|
||||
// Verify that a PgSqlStore with no database name is rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(invalidConnectString());
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_THROW(LegalLogMgrFactory::instance()->open(), DbOpenError);
|
||||
ASSERT_THROW(LegalLogMgrFactory::addBackend(params), DbOpenError);
|
||||
|
||||
io_service_->poll();
|
||||
|
||||
@@ -763,11 +748,7 @@ PgSqlLegalLogDbLostCallbackTest::testDbLostAndRecoveredCallback() {
|
||||
// Verify that a PgSqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(validConnectString());
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
LegalLogMgrFactory::setParameters(params);
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
@@ -821,10 +802,7 @@ PgSqlLegalLogDbLostCallbackTest::testDbLostAndFailedCallback() {
|
||||
// Verify that a PgSqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(validConnectString());
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
@@ -885,11 +863,7 @@ PgSqlLegalLogDbLostCallbackTest::testDbLostAndRecoveredAfterTimeoutCallback() {
|
||||
// Verify that a PgSqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(access);
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
LegalLogMgrFactory::setParameters(params);
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
@@ -979,10 +953,7 @@ PgSqlLegalLogDbLostCallbackTest::testDbLostAndFailedAfterTimeoutCallback() {
|
||||
// Verify that a PgSqlStore with database name is not rejected.
|
||||
DatabaseConnection::ParameterMap params = db::DatabaseConnection::parse(access);
|
||||
|
||||
ASSERT_NO_THROW_LOG(LegalLogMgrFactory::instance().reset(new PgSqlStore(params)));
|
||||
|
||||
// Check params validity is done by open().
|
||||
EXPECT_NO_THROW_LOG(LegalLogMgrFactory::instance()->open());
|
||||
ASSERT_NO_THROW(LegalLogMgrFactory::addBackend(params));
|
||||
|
||||
ASSERT_TRUE(LegalLogMgrFactory::instance());
|
||||
|
||||
|
@@ -35,9 +35,6 @@ class LegalLogMgr;
|
||||
/// @brief Defines a smart pointer to a LegalLogMgr.
|
||||
typedef boost::shared_ptr<LegalLogMgr> LegalLogMgrPtr;
|
||||
|
||||
/// @brief Manger ID used by hook libraries to retrieve respective LegalLogMgr instance.
|
||||
typedef uint64_t ManagerID;
|
||||
|
||||
/// @brief LegalLogMgr abstract class
|
||||
class LegalLogMgr {
|
||||
public:
|
||||
@@ -87,9 +84,7 @@ public:
|
||||
static void parseExtraParameters(const isc::data::ConstElementPtr& parameters, isc::db::DatabaseConnection::ParameterMap& map);
|
||||
|
||||
/// @brief Opens the store.
|
||||
///
|
||||
/// @param id the forensic backend manager ID.
|
||||
virtual void open(ManagerID id = 0) = 0;
|
||||
virtual void open() = 0;
|
||||
|
||||
/// @brief Closes the store.
|
||||
virtual void close() = 0;
|
||||
@@ -272,6 +267,9 @@ private:
|
||||
isc::db::DatabaseConnection::ParameterMap parameters_;
|
||||
};
|
||||
|
||||
/// @brief Manger ID used by hook libraries to retrieve respective LegalLogMgr instance.
|
||||
typedef uint64_t ManagerID;
|
||||
|
||||
/// @brief LegalLogMgr pool
|
||||
typedef std::map<ManagerID, std::pair<isc::db::DatabaseConnection::ParameterMap, LegalLogMgrPtr>> LegalLogMgrPool;
|
||||
|
||||
|
@@ -104,7 +104,7 @@ LegalLogMgrFactory::addBackend(DatabaseConnection::ParameterMap& parameters, Man
|
||||
// Add the parameters and an empty instance in case retry on startup is configured.
|
||||
pool_[id] = pair<DatabaseConnection::ParameterMap, LegalLogMgrPtr>(parameters, LegalLogMgrPtr());
|
||||
|
||||
backend->open(id);
|
||||
backend->open();
|
||||
|
||||
// Apply extra parameters.
|
||||
if (parameters.find("request-parser-format") != parameters.end()) {
|
||||
|
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
|
||||
/// @brief Opens the store.
|
||||
virtual void open(ManagerID) {
|
||||
virtual void open() {
|
||||
}
|
||||
|
||||
/// @brief Closes the store.
|
||||
|
Reference in New Issue
Block a user