When deleting objects using the REST API while the nodes aren't connected in an HA zone results in the objects reappearing at a later time.
To Reproduce
- Start with an HA master setup with both running.
- Create a few objects using the API:
for i in {1..100}; do
curl --fail-with-body -sSku root:icinga -X PUT "https://localhost:5665/v1/objects/hosts/test-delete-$i" \
--json '{"attrs": {"check_command":"dummy"}}'
done
- Check
/var/lib/icinga2/api/packages/_api/*/conf.d/hosts/test-delete-*.conf on both masters to verify the objects exist on both.
- Stop the second master.
- Delete the just created objects via API on the first master:
for i in {1..100}; do
curl --fail-with-body -sSku root:icinga -X DELETE "https://localhost:5665/v1/objects/hosts/test-delete-$i" \
--json '{"cascade": true}'
done
- Repeat step 3, there should be none remaining on the first master and all on the second as it's not running.
- Start the second master again.
- Wait a bit for the masters to sync and repeat step 3 again. This is where things start to go wrong: the objects disappeared from the second master but reappeared on the first.
- Restart the second master.
- Wait for them to sync and repeat step 3 again. Now the objects are also reappearing on the second master and the objects exist on both masters again.
Theory on what happens
When both masters reconnect, both generate messages to sync the other. The first master will replay the delete messages to the second and the second will send the object updates for the (from its perspective still existing) objects to the first master causing them to reappear.
Your Environment
Tested with the current master (9e31b8b).
When deleting objects using the REST API while the nodes aren't connected in an HA zone results in the objects reappearing at a later time.
To Reproduce
/var/lib/icinga2/api/packages/_api/*/conf.d/hosts/test-delete-*.confon both masters to verify the objects exist on both.Theory on what happens
When both masters reconnect, both generate messages to sync the other. The first master will replay the delete messages to the second and the second will send the object updates for the (from its perspective still existing) objects to the first master causing them to reappear.
Your Environment
Tested with the current master (9e31b8b).