[9.18] Implement incremental hash table resizing in isc_ht
Previously, an incremental hash table resizing was implemented for the dns_rbt_t hash table implementation. Using that as a base, also implement the incremental hash table resizing also for isc_ht API hashtables:
- During the resize, allocate the new hash table, but keep the old table unchanged.
- In each lookup, delete, or iterator operation, check both tables.
- Perform insertion operations only in the new table.
- At each insertion also move elements from the old table to the new table.
- When all elements are removed from the old table, deallocate it.
To ensure that the old table is completely copied over before the new table itself needs to be enlarged, it is necessary to increase the size of the table by a factor of at least ( + 1)/ during resizing.
In our implementation is equal to 1.
The downside of this approach is that the old table and the new table could stay in memory for longer when there are no new insertions into the hash table for prolonged periods of time as the incremental rehashing happens only during the insertions.
(cherry picked from commit e42cb1f1)
Closes #3212 (closed)
Backport of MR !5983 (merged)