[pbs-devel] [PATCH proxmox-backup] prune sim: correctly keep track of already included backups

Fabian Ebner f.ebner at proxmox.com
Mon Dec 14 16:08:03 CET 2020


Forgot to mention that it's better viewed with --patience

Am 14.12.20 um 16:04 schrieb Fabian Ebner:
> This needs to happen in a separate loop, because some time intervals are not
> subsets of others, i.e. weeks and months. Previously, with a daily backup
> schedule, having:
> * a backup on Sun, 06 Dec 2020 kept by keep-daily
> * a backup on Sun, 29 Nov 2020 kept by keep-weekly
> would lead to the backup on Mon, 30 Nov 2020 to be selected for keep-monthly,
> because the iteration did not yet reach the backup on Sun, 29 Nov 2020 that
> would mark November as being covered.
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>   docs/prune-simulator/prune-simulator.js | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/docs/prune-simulator/prune-simulator.js b/docs/prune-simulator/prune-simulator.js
> index 5533c2d6..55cd548b 100644
> --- a/docs/prune-simulator/prune-simulator.js
> +++ b/docs/prune-simulator/prune-simulator.js
> @@ -485,16 +485,17 @@ Ext.onReady(function() {
>   
>   		backups.forEach(function(backup) {
>   		    let mark = backup.mark;
> -		    let id = idFunc(backup);
> -
> -		    if (finished || alreadyIncluded[id]) {
> -			return;
> +		    if (mark && mark === 'keep') {
> +			let id = idFunc(backup);
> +			alreadyIncluded[id] = true;
>   		    }
> +		});
>   
> -		    if (mark) {
> -			if (mark === 'keep') {
> -			    alreadyIncluded[id] = true;
> -			}
> +		backups.forEach(function(backup) {
> +		    let mark = backup.mark;
> +		    let id = idFunc(backup);
> +
> +		    if (finished || alreadyIncluded[id] || mark) {
>   			return;
>   		    }
>   
> 





More information about the pbs-devel mailing list