[Kea-users] PostgreSQL lease management

Tomek Mrugalski tomasz at isc.org
Wed Feb 1 22:39:04 UTC 2017


W dniu 01.02.2017 o 22:09, James Sumners pisze:
> Is there a document that describes how the leases database is managed
> when it is stored in PostgreSQL? In particular, I want to look at the
> queries that are involved, so something like [1] would be great.
> 
> I want to devise a trigger to archive leases to another table when they
> are being reaped.
> 
> [1] —
> http://kea.isc.org/wiki/HostReservationsHowTo#QueriesUsedbytheKeaServer
Not in a such easy format to read, but the information is there.

The schema itself is available in
src/share/database/scripts/pgsql/dhcpdb_create.pgsql.

The actual queries Kea code uses are in 2 files:

src/lib/dhcpsrv/pgsql_lease_mgr.cc (for leases)
src/lib/dhcpsrv/pgsql_host_data_source.cc (for host reservations)

It's a C++ code, but SQL queries are there in plain text, just search
for "tagged_statements". One way to browse those files would be our
github repo: https://github.com/isc-projects/kea/

On one hand writing such a document is useful, but on the other hand
there's the danger of it being outdated without anyone noticing.

Hope that helps,
Tomek




More information about the Kea-users mailing list