diff options
author | Thomas Markwalder <tmark@isc.org> | 2016-08-24 16:40:34 +0200 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2016-08-24 16:40:34 +0200 |
commit | 569b5a87dce77cb1ff3f858075685fbf6cb40337 (patch) | |
tree | dec753880d36f47a801259442a3838937a811903 /src/lib | |
parent | [4294] Refactored MySql stats classes (diff) | |
download | kea-569b5a87dce77cb1ff3f858075685fbf6cb40337.tar.xz kea-569b5a87dce77cb1ff3f858075685fbf6cb40337.zip |
[4294] Minor clean ups
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/dhcpsrv/dhcpsrv_messages.mes | 3 | ||||
-rw-r--r-- | src/lib/dhcpsrv/memfile_lease_mgr.h | 4 | ||||
-rw-r--r-- | src/lib/dhcpsrv/mysql_lease_mgr.cc | 16 | ||||
-rw-r--r-- | src/lib/dhcpsrv/tests/alloc_engine_utils.cc | 2 | ||||
-rw-r--r-- | src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc | 18 | ||||
-rw-r--r-- | src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h | 6 |
6 files changed, 22 insertions, 27 deletions
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index db03ed0bb0..714148548c 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -923,6 +923,3 @@ lease from the Cassandra database for the specified address. % DHCPSRV_CQL_UPDATE_ADDR6 updating IPv6 lease for address %1 A debug message issued when the server is attempting to update IPv6 lease from the Cassandra database for the specified address. - -% TOMS_UTILITY_MESSAGE %1 -Handy log message that should be deleted diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.h b/src/lib/dhcpsrv/memfile_lease_mgr.h index d996b45dcb..bdbd985511 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.h +++ b/src/lib/dhcpsrv/memfile_lease_mgr.h @@ -598,7 +598,7 @@ public: /// @brief Creates and runs the IPv4 lease stats query /// /// It creates an instance of a MemfileLeaseStatsQuery4 and then - /// invokes it's start method in which the query constructs its + /// invokes its start method in which the query constructs its /// statistical data result set. The query object is then returned. /// /// @return The populated query as a pointer to an LeaseStatsQuery @@ -607,7 +607,7 @@ public: /// @brief Creates and runs the IPv6 lease stats query /// /// It creates an instance of a MemfileLeaseStatsQuery6 and then - /// invokes it's start method in which the query constructs its + /// invokes its start method in which the query constructs its /// statistical data result set. The query object is then returned. /// /// @return The populated query as a pointer to an LeaseStatsQuery. diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index 30af2f0d0f..0017a690d3 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -1240,7 +1240,10 @@ public: MySqlLeaseStatsQuery(MySqlConnection& conn, const size_t statement_index, const bool fetch_type) : conn_(conn), statement_index_(statement_index), statement_(NULL), - fetch_type_(fetch_type), bind_(fetch_type_ ? 4 : 3) { + fetch_type_(fetch_type), + // Set the number of columns in the bind array based on fetch_type + // This is the number of columns expected in the result set + bind_(fetch_type_ ? 4 : 3) { if (statement_index_ >= MySqlLeaseMgr::NUM_STATEMENTS) { isc_throw(BadValue, "MySqlLeaseStatsQuery" " - invalid statement index" << statement_index_); @@ -1256,12 +1259,11 @@ public: /// @brief Creates the IPv4 lease statistical data result set /// - /// The result set is populated by executing an SQL query against the - /// lease4 table which sums the leases per lease state per subnet id. - /// The query used is the prepared statement identified by - /// MySqlLeaseMgr::RECOUNT_LEASE4_STATS. This method creates the binds - /// the statement to the output bind array and then executes the - /// statement. + /// The result set is populated by executing a SQL query against the + /// lease(4/6) table which sums the leases per lease state per lease + /// type (v6 only) per subnet id. This method binds the statement to + /// the output bind array and then executes the statement, and fetches + /// entire result set. void start() { int col = 0; // subnet_id: unsigned int diff --git a/src/lib/dhcpsrv/tests/alloc_engine_utils.cc b/src/lib/dhcpsrv/tests/alloc_engine_utils.cc index 9beb306609..764ad60ee1 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine_utils.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine_utils.cc @@ -123,6 +123,7 @@ AllocEngine4Test::generateDeclinedLease(const std::string& addr, AllocEngine6Test::AllocEngine6Test() { CfgMgr::instance().clear(); + // This lease mgr needs to exist to before configuration commits. factory_.create("type=memfile universe=6 persist=false"); duid_ = DuidPtr(new DUID(std::vector<uint8_t>(8, 0x42))); @@ -527,6 +528,7 @@ AllocEngine4Test::initSubnet(const asiolink::IOAddress& pool_start, AllocEngine4Test::AllocEngine4Test() { + // This lease mgr needs to exist to before configuration commits. factory_.create("type=memfile universe=4 persist=false"); // Create fresh instance of the HostMgr, and drop any previous HostMgr state. diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc index 57511fef8e..25d1b2bd07 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc @@ -2475,11 +2475,9 @@ GenericLeaseMgrTest::testRecountLeaseStats4() { StatsMgr::instance().removeAll(); - // create subnets - CfgSubnets4Ptr cfg = - CfgMgr::instance().getStagingCfg()->getCfgSubnets4(); - - // Create 3 subnets. + // Create two subnets. + int num_subnets = 2; + CfgSubnets4Ptr cfg = CfgMgr::instance().getStagingCfg()->getCfgSubnets4(); Subnet4Ptr subnet; Pool4Ptr pool; @@ -2493,7 +2491,6 @@ GenericLeaseMgrTest::testRecountLeaseStats4() { subnet->addPool(pool); cfg->add(subnet); - int num_subnets = 2; ASSERT_NO_THROW(CfgMgr::instance().commit()); @@ -2571,14 +2568,11 @@ GenericLeaseMgrTest::testRecountLeaseStats6() { StatsMgr::instance().removeAll(); - // create subnets - CfgSubnets6Ptr cfg = - CfgMgr::instance().getStagingCfg()->getCfgSubnets6(); - - // Create 3 subnets. + // Create two subnets. + int num_subnets = 2; + CfgSubnets6Ptr cfg = CfgMgr::instance().getStagingCfg()->getCfgSubnets6(); Subnet6Ptr subnet; Pool6Ptr pool; - int num_subnets = 2; StatValMapList expectedStats(num_subnets); int subnet_id = 1; diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h index ec6a4b4837..f426787833 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h @@ -112,10 +112,10 @@ public: /// @brief Compares StatsMgr statistics against an expected list of values /// - /// Iterates over a list of statistic names and expectec values, attempting + /// Iterates over a list of statistic names and expected values, attempting /// to fetch each from the StatsMgr and if found, compare its observed value - /// to the expected value. Fails any the stat is not found or if the values - /// do not match. + /// to the expected value. Fails if any of the expected stats are not + /// found or if the values do not match. /// /// @param expected_stats Map of expected static names and values. void checkLeaseStats(const StatValMapList& expected_stats); |