... | ... | @@ -89,6 +89,8 @@ The SQL backends store information about allocated leases in the `lease4` and `l |
|
|
|
|
|
The challenging part is how to efficiently populate the unallocated leases to the `lease4_avail` and `lease6_avail` tables. Let's start with the divagations about the IPv4 case first.
|
|
|
|
|
|
## Tables and Queries for IPv4
|
|
|
|
|
|
The available addresses are populated for individual address pools. For each such address pool we have to make a query which finds "gaps" in the `lease4` table and creates the corresponding entries in the `lease4_avail` table. IPv4 addresses are represented as 4 byte integers in the database. They can be sorted in the ascending order as a sequence of numbers and the typical techniques for finding gaps in a sequence of numbers can be applied.
|
|
|
|
|
|
The following query in PostgreSQL:
|
... | ... | |