Add an option to remove the backup of node policy at the end of policy generation
When we generate policies, we are deleting previous backup, moving previous policies to backup folder, and moving new policies to final position. This can be really long (if it's on a different mount point, it can take up to a 1/3 of the policy generation time, for instance with 10 000 nodes, it took 1200 seconds), but we need to move the previous policies out of the way to have unitary changes - ticket #16072 takes care of documenting that they should be on the same FS.
Ultimately, these backup are rarely used, so we could simply drop them async at the end of generation, so that we don't have to delete them during next policy generation, and save some disk space, time and IO - this could be done via a post generation hook
- remove the backup of previous policies at the end generation
curl -k -H "X-API-Token: xxx" -X POST 'https://.../rudder/api/latest/settings/rudder_remove_previous_policies' -d "value=true"
Updated by Nicolas CHARLES over 1 year ago
- Status changed from Pending technical review to In progress
it's a bit more complex than that - deleting rather than moving the old policies is not atomic, so can end up with broken policies on the node/relay if shared at the wrong time (the error windows is too large).
Note that having /var/rudder/backup on a different fs than /var/rudder/share result also in non atomic change (the move is a copy+delete)