Refactor persistent zone timers
The current persistent timers database contains timers for zone expiration, zone refresh, and zone flush. The values are just copied from scheduled zone timers.
The zone refresh and zone flush are events which are always scheduled. And are rescheduled when they happen. (The refresh timer is not running if the server isn't slave. Not important.) The problem is zone expiration. The zone expiration timer is started when we do a refresh and fail to connect to the master server. If the slave is turned off for a while and turn on later, we can discover that the zone is expired and that it shouldn't be loaded. But when the zone expiration happens, the timer is cleared both in server and the persistent database. Therefore the next restart of the slave server will make the zone available again as we cannot detect the expiration.
Another issue is that when the server is turned off for a long time. If the zone expires during that period and the expire timer was not set (master was available at the server's shutdown time), we won't expire the zone.
Possible solution: The timers database could store absolute time of zone expiration, next (or last?) zone refresh, and last zone flush.
Issues:
-
zone expiration when the server is turned off -
change of flush timer in configuration is not honored -
bootstrap timer is not persistent (uses transfer timer)