HA hook with mysql backend not working
Hello, I Have problem with HA (in my case hot-standby). Server is unable to sync leases.
2020-09-25 09:51:32.806 DEBUG [kea-dhcp4.dhcpsrv/34387.140540437956480] DHCPSRV_MYSQL_GET_ADDR4 obtaining IPv4 lease for address 100.104.3.2
2020-09-25 09:51:32.806 DEBUG [kea-dhcp4.dhcpsrv/34387.140540437956480] DHCPSRV_MYSQL_UPDATE_ADDR4 updating IPv4 lease for address 100.104.3.2
2020-09-25 09:51:32.806 WARN [kea-dhcp4.ha-hooks/34387.140540437956480] HA_LEASE_SYNC_FAILED synchronization failed for lease: { "cltt": 1600979173, "fqdn-fwd": true, "fqdn-rev": true, "hostname": "lt_pohorany_137_eap1", "hw-address": "c4:ad:34:ce:99:64", "ip-address": "100.104.3.2", "state": 0, "subnet-id": 10010400, "valid-lft": 432000 }, reason: unable to update lease for address 100.104.3.2 as it does not exist
mysql debug:
2020-09-25T07:51:32.806428Z 370 Execute SELECT address, hwaddr, client_id, valid_lifetime, expire, subnet_id, fqdn_fwd, fqdn_rev, hostname, state, user_context FROM lease4 WHERE address = 1684538114
2020-09-25T07:51:32.806540Z 370 Execute UPDATE lease4 SET address = 1684538114, hwaddr = 'ĭ4Ιd', client_id = NULL, valid_lifetime = 432000, expire = '2020-09-29 22:26:13', subnet_id = 10010400, fqdn_fwd = 1, fqdn_rev = 1, hostname = 'lt_pohorany_137_eap1', state = 0, user_context = NULL WHERE address = 1684538114 AND expire = '1970-01-01 01:00:00'
you can see it tries to match weird expire value '1970-01-01 01:00:00' but in database is:
mysql> SELECT * FROM dhcp.lease4 WHERE address=1684538114;
+------------+--------+-----------+----------------+---------------------+-----------+----------+----------+----------------------+-------+--------------+
| address | hwaddr | client_id | valid_lifetime | expire | subnet_id | fqdn_fwd | fqdn_rev | hostname | state | user_context |
+------------+--------+-----------+----------------+---------------------+-----------+----------+----------+----------------------+-------+--------------+
| 1684538114 | ĭ4Ιd | NULL | 432000 | 2020-09-27 10:26:13 | 10010400 | 1 | 1 | lt_pohorany_137_eap1 | 0 | NULL |
+------------+--------+-----------+----------------+---------------------+-----------+----------+----------+----------------------+-------+--------------+
1 row in set (0.00 sec)
Time is synchronized on both server. Same timezone selected.
Expected behavior
- Lease on remote site will update
Environment:
- Kea version: 1.8.0 + libdhcp_lease_cmds + libdhcp_ha
- OS: Debian x64
- Mysql server: 5.7.31 (Percona Server)