write or delete database operations should be handled properly
Some operations, like deleteLease are not handled properly and can generate inconsistent stats when using multiple servers sharing the database or when using MT
Also, there could be situations like updateLease performed in parallel on the same lease (eg: 2 clients are starting up and requesting an address which has expired in the database). This can be fixed by extending the update statements with an explicit condition like:
update ... where ... AND expire = $old_expire
As the update functions throw if there is no affected line, this simple fix can guarantee the desired behavior.
This issues resolves:
-
separate delete functions to be able to use lease data (old expire time) !619 (merged) -
update all database queries (update and delete) to use old expire time to make actions atomic !614 (closed) or !640 (merged) -
handle update and delete functions returned result or exceptions to maintain stats consistency !621 (closed) or !645 (merged)
Edited by Razvan Becheriu