]> git.proxmox.com Git - pve-guest-common.git/commit
replication: update last_sync before removing old replication snapshots
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 26 Nov 2021 10:52:30 +0000 (11:52 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 29 Nov 2021 09:50:36 +0000 (10:50 +0100)
commitff574bf8d2331805d12b3b2afd752ce5bd52f62e
tree5fb6be3ce2ce6abe0b20c023fea69cb42cbc0e77
parent7d604b5bbd69fc43f1043b8c389db9cc78cd9c58
replication: update last_sync before removing old replication snapshots

If pvesr was terminated after finishing with the new sync and after
removing old replication snapshots, but before it could write the new
state, the next replication would fail. It would wrongly interpret the
actual last replication snapshot as stale, remove it, and (if no other
snapshots are present) attempt a full sync, which would fail.

Reported in the community forum [0], this was brought to light by the
new pvescheduler before it learned graceful reload.

It's not possible to simply preserve a last remaining snapshot in
prepare(), because prepare() is also used for valid removals. Instead,
update last_sync early enough. Stale snapshots will still be removed
on the next run if there are any.

[0]: https://forum.proxmox.com/threads/100154

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
src/PVE/Replication.pm
src/PVE/ReplicationState.pm