Prevent existing catalog zone entries being incorrectly deleted
After receiving a new version of a catalog zone it is required to merge it with the old version.
The algorithm walks through the new version's hash table and applies the following logic:
- If an entry from the new version does not exist in the old
version, then it's a new entry, add the entry to the
- If the zone does not exist in the set of configured zones, because
it was deleted via rndc delzone or it was removed from another
catalog zone instance, then add into to the
toaddhash table to be reinstantiated.
- If an entry from the new version also exists in the old version,
but is modified, then add the entry to the
tomodhash table, then remove it from the old version's hash table.
- If an entry from the new version also exists in the old version and is the same (unmodified) then just remove it from the old version's hash table.
The algorithm then deletes all the remaining zones which still exist
in the old version's hash table (because only the ones that don't
exist in the new version should now remain there), then adds the ones
that were added to the
toadd, and modifies the ones that were added
tomod, completing the merge.
During a recent refactoring, the part when the entry should be removed from the old version's hash table on condition (4.) above was accidentally omitted, so the unmodified zones were remaining in the old version's hash table and consequently being deleted.
(cherry picked from commit 63145fb1)
Closes #2947 (closed)