This patch changes the behaviour of dss in case the following three
conditions are all met:
(1) There is at least one snapshot which could be deleted
(orphaned, redundant, outdated).
(2) Disk space is not low.
(3) A new snapshot is due.
A common case where these conditions are fulfilled is when dss is
started after it was not running for some time, for example due to
a server crash on Friday evening...
In this situation the old code created a new snapshot only after all
orphaned/redundant/outdated have been removed, which can take hours
and is not what one usually wants to happen in the above mentioned
scenario. Instead, it is desirable to create a new snapshot ASAP,
and only after this snapshot has been created, the removal of old
snapshots should take place.
This patch implements this behaviour and goes even one step further:
If disk space is not low and a new snapshot is due or being created,
dss won't trigger snapshot removal any more.
Another positive side effect of this change is that snapshot creation
times become more stable since the rsync process will only be
interrupted by a rm process if disk space is low.
gettimeofday(&now, NULL);
if (tv_diff(&next_removal_check, &now, NULL) > 0)
return 0;
- if (!low_disk_space && conf.keep_redundant_given)
- return 0;
+ if (!low_disk_space) {
+ if (conf.keep_redundant_given)
+ return 0;
+ if (snapshot_creation_status != HS_READY)
+ return 0;
+ if (next_snapshot_is_due())
+ return 0;
+ }
dss_get_snapshot_list(&sl);
ret = 0;
if (!low_disk_space && sl.num_snapshots <= 1)