Browse Source

[4294] Minor clean ups

Thomas Markwalder 8 years ago
parent
commit
569b5a87dc

+ 0 - 3
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

+ 2 - 2
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.

+ 9 - 7
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

+ 2 - 0
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.

+ 6 - 12
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;

+ 3 - 3
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);