summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2015-09-07 14:24:57 +0200
committerMarcin Siodelski <marcin@isc.org>2015-09-07 14:24:57 +0200
commit04621a507aa3b1432543e40d4df68d75becede54 (patch)
tree78e707c329309115815710d6c2185f45b9de756b /src/lib/dhcpsrv
parent[3966] Implemented deletion of the reclaimed leases in MySQL. (diff)
downloadkea-04621a507aa3b1432543e40d4df68d75becede54.tar.xz
kea-04621a507aa3b1432543e40d4df68d75becede54.zip
[3966] Added missing logging trces to MySQL and Memfile.
Diffstat (limited to 'src/lib/dhcpsrv')
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.mes37
-rw-r--r--src/lib/dhcpsrv/memfile_lease_mgr.cc6
-rw-r--r--src/lib/dhcpsrv/mysql_lease_mgr.cc19
3 files changed, 61 insertions, 1 deletions
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes
index 8dd151e9df..b0e87938c9 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.mes
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes
@@ -266,6 +266,16 @@ A debug message issued when the server is attempting to obtain an IPv4
lease from the memory file database for a client with the specified
client ID, hardware address and subnet ID.
+% DHCPSRV_MEMFILE_GET_EXPIRED4 obtaining expired IPv4 leases with limit %1
+A debug message issued when the server is attempting to obtain expired
+IPv4 leases to reclaim them. The maximum number of leases to be retrieved
+is logged in the message.
+
+% DHCPSRV_MEMFILE_GET_EXPIRED6 obtaining expired IPv6 leases with limit %1
+A debug message issued when the server is attempting to obtain expired
+IPv6 leases to reclaim them. The maximum number of leases to be retrieved
+is logged in the message.
+
% DHCPSRV_MEMFILE_GET_HWADDR obtaining IPv4 leases for hardware address %1
A debug message issued when the server is attempting to obtain a set of
IPv4 leases from the memory file database for a client with the specified
@@ -391,6 +401,23 @@ connection including database name and username needed to access it
A debug message issued when the server is attempting to delete a lease for
the specified address from the MySQL database for the specified address.
+% DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed leases expired more than %1 s ago
+A debug message issued when the server is removing reclaimed DHCPv4
+leases which have expired longer than a specified period of time.
+The argument specified the number of seconds since leases' expiration
+before they can be removed.
+
+% DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed leases expired more than %1 s ago
+A debug message issued when the server is removing reclaimed DHCPv6
+leases which have expired longer than a specified period of time.
+The argument specified the number of seconds since leases' expiration
+before they can be removed.
+
+% DHCPSRV_MYSQL_DELETED_EXPIRED_RECLAIMED deleted %1 reclaimed leases from the database
+A debug message issued when the server has removed a number of reclaimed
+leases from the database. The number of removed leases is included in the
+message.
+
% DHCPSRV_MYSQL_GET_ADDR4 obtaining IPv4 lease for address %1
A debug message issued when the server is attempting to obtain an IPv4
lease from the MySQL database for the specified address.
@@ -404,6 +431,16 @@ A debug message issued when the server is attempting to obtain a set
of IPv4 leases from the MySQL database for a client with the specified
client identification.
+% DHCPSRV_MYSQL_GET_EXPIRED4 obtaining expired IPv4 leases with limit %1
+A debug message issued when the server is attempting to obtain expired
+IPv4 leases to reclaim them. The maximum number of leases to be retrieved
+is logged in the message.
+
+% DHCPSRV_MYSQL_GET_EXPIRED6 obtaining expired IPv6 leases with limit %1
+A debug message issued when the server is attempting to obtain expired
+IPv6 leases to reclaim them. The maximum number of leases to be retrieved
+is logged in the message.
+
% DHCPSRV_MYSQL_GET_HWADDR obtaining IPv4 leases for hardware address %1
A debug message issued when the server is attempting to obtain a set
of IPv4 leases from the MySQL database for a client with the specified
diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc
index 46e06d15c0..15cb004b6a 100644
--- a/src/lib/dhcpsrv/memfile_lease_mgr.cc
+++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc
@@ -506,6 +506,9 @@ Memfile_LeaseMgr::getLeases6(Lease::Type type,
void
Memfile_LeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
const size_t max_leases) const {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_EXPIRED4)
+ .arg(max_leases);
+
// Obtain the index which segragates leases by state and time.
const Lease6StorageExpirationIndex& index = storage6_.get<ExpirationIndexTag>();
@@ -528,6 +531,9 @@ Memfile_LeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
void
Memfile_LeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
const size_t max_leases) const {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET_EXPIRED6)
+ .arg(max_leases);
+
// Obtain the index which segragates leases by state and time.
const Lease4StorageExpirationIndex& index = storage4_.get<ExpirationIndexTag>();
diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc
index a3902c59c6..244fe3e065 100644
--- a/src/lib/dhcpsrv/mysql_lease_mgr.cc
+++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc
@@ -2014,12 +2014,16 @@ MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
void
MySqlLeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
const size_t max_leases) const {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_EXPIRED6)
+ .arg(max_leases);
getExpiredLeasesCommon(expired_leases, max_leases, GET_LEASE6_EXPIRE);
}
void
MySqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
const size_t max_leases) const {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_EXPIRED4)
+ .arg(max_leases);
getExpiredLeasesCommon(expired_leases, max_leases, GET_LEASE4_EXPIRE);
}
@@ -2203,11 +2207,17 @@ MySqlLeaseMgr::deleteLease(const isc::asiolink::IOAddress& addr) {
uint64_t
MySqlLeaseMgr::deleteExpiredReclaimedLeases4(const uint32_t secs) {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
+ DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED4)
+ .arg(secs);
return (deleteExpiredReclaimedLeasesCommon(secs, DELETE_LEASE4_STATE_EXPIRED));
}
uint64_t
MySqlLeaseMgr::deleteExpiredReclaimedLeases6(const uint32_t secs) {
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
+ DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED6)
+ .arg(secs);
return (deleteExpiredReclaimedLeasesCommon(secs, DELETE_LEASE6_STATE_EXPIRED));
}
@@ -2218,6 +2228,7 @@ MySqlLeaseMgr::deleteExpiredReclaimedLeasesCommon(const uint32_t secs,
MYSQL_BIND inbind[2];
memset(inbind, 0, sizeof(inbind));
+ // State is reclaimed.
uint32_t state = static_cast<uint32_t>(Lease::STATE_EXPIRED_RECLAIMED);
inbind[0].buffer_type = MYSQL_TYPE_LONG;
inbind[0].buffer = reinterpret_cast<char*>(&state);
@@ -2230,7 +2241,13 @@ MySqlLeaseMgr::deleteExpiredReclaimedLeasesCommon(const uint32_t secs,
inbind[1].buffer = reinterpret_cast<char*>(&expire_time);
inbind[1].buffer_length = sizeof(expire_time);
- return (deleteLeaseCommon(statement_index, inbind));
+ // Get the number of deleted leases and log it.
+ uint64_t deleted_leases = deleteLeaseCommon(statement_index, inbind);
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
+ DHCPSRV_MYSQL_DELETED_EXPIRED_RECLAIMED)
+ .arg(deleted_leases);
+
+ return (deleted_leases);
}