2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-03 23:45:27 +00:00

[3966] Added missing logging trces to MySQL and Memfile.

This commit is contained in:
Marcin Siodelski
2015-09-07 14:24:57 +02:00
parent f127bed4fb
commit 04621a507a
3 changed files with 61 additions and 1 deletions

View File

@@ -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 lease from the memory file database for a client with the specified
client ID, hardware address and subnet ID. 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 % 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 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 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 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. 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 % DHCPSRV_MYSQL_GET_ADDR4 obtaining IPv4 lease for address %1
A debug message issued when the server is attempting to obtain an IPv4 A debug message issued when the server is attempting to obtain an IPv4
lease from the MySQL database for the specified address. 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 of IPv4 leases from the MySQL database for a client with the specified
client identification. 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 % DHCPSRV_MYSQL_GET_HWADDR obtaining IPv4 leases for hardware address %1
A debug message issued when the server is attempting to obtain a set 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 of IPv4 leases from the MySQL database for a client with the specified

View File

@@ -506,6 +506,9 @@ Memfile_LeaseMgr::getLeases6(Lease::Type type,
void void
Memfile_LeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases, Memfile_LeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
const size_t max_leases) const { 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. // Obtain the index which segragates leases by state and time.
const Lease6StorageExpirationIndex& index = storage6_.get<ExpirationIndexTag>(); const Lease6StorageExpirationIndex& index = storage6_.get<ExpirationIndexTag>();
@@ -528,6 +531,9 @@ Memfile_LeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
void void
Memfile_LeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases, Memfile_LeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
const size_t max_leases) const { 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. // Obtain the index which segragates leases by state and time.
const Lease4StorageExpirationIndex& index = storage4_.get<ExpirationIndexTag>(); const Lease4StorageExpirationIndex& index = storage4_.get<ExpirationIndexTag>();

View File

@@ -2014,12 +2014,16 @@ MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
void void
MySqlLeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases, MySqlLeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
const size_t max_leases) const { 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); getExpiredLeasesCommon(expired_leases, max_leases, GET_LEASE6_EXPIRE);
} }
void void
MySqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases, MySqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
const size_t max_leases) const { 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); getExpiredLeasesCommon(expired_leases, max_leases, GET_LEASE4_EXPIRE);
} }
@@ -2203,11 +2207,17 @@ MySqlLeaseMgr::deleteLease(const isc::asiolink::IOAddress& addr) {
uint64_t uint64_t
MySqlLeaseMgr::deleteExpiredReclaimedLeases4(const uint32_t secs) { 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)); return (deleteExpiredReclaimedLeasesCommon(secs, DELETE_LEASE4_STATE_EXPIRED));
} }
uint64_t uint64_t
MySqlLeaseMgr::deleteExpiredReclaimedLeases6(const uint32_t secs) { 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)); return (deleteExpiredReclaimedLeasesCommon(secs, DELETE_LEASE6_STATE_EXPIRED));
} }
@@ -2218,6 +2228,7 @@ MySqlLeaseMgr::deleteExpiredReclaimedLeasesCommon(const uint32_t secs,
MYSQL_BIND inbind[2]; MYSQL_BIND inbind[2];
memset(inbind, 0, sizeof(inbind)); memset(inbind, 0, sizeof(inbind));
// State is reclaimed.
uint32_t state = static_cast<uint32_t>(Lease::STATE_EXPIRED_RECLAIMED); uint32_t state = static_cast<uint32_t>(Lease::STATE_EXPIRED_RECLAIMED);
inbind[0].buffer_type = MYSQL_TYPE_LONG; inbind[0].buffer_type = MYSQL_TYPE_LONG;
inbind[0].buffer = reinterpret_cast<char*>(&state); 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 = reinterpret_cast<char*>(&expire_time);
inbind[1].buffer_length = sizeof(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);
} }