[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Bug in hot-backup.py

From: Jeff Hinrichs <jeffh_at_delasco.com>
Date: 2003-02-27 04:16:13 CET

Edmund Lian said:
> There is an assumption in hot-backup.py that causes the number of
> backups to grow out of control. In the script, step 8 is:
>
> # Step 8: finally, remove the repository back that's NUM_BACKUPS
> older # than the one we just created.
>
> kill_rev = int(youngest) - num_backups
> old_backup_subdir = os.path.join(backup_dir, repo + "-" +
> `kill_rev`) if os.path.exists(old_backup_subdir):
> print "Removing old backup: " + old_backup_subdir
> shutil.rmtree(old_backup_subdir)
>
> The problem is that step 8 assumes the revision numbers associated with
> a hot backup increase in increments of 1. When this is not the case,
> step 8 fails to find and delete old backups.
>
> Example: Suppose the backup directory contains: svn-208, svn-209,
> svn-212, svn-219, svn-221 and that the repository is at revision 225
> when
> hot-backup.py is run. Suppose hot-backup.py was modified to keep 4
> backups. Then, when it is run, kill_rev = 225 - 3 (= 222), so hot-backup
> tries to find and delete svn-222, but completely overlooks the fact that
> the earlier backups exist.
>
> I'm wondering what is the best way to fix hot-backup.py. Any
> suggestions?
If newer revs are guaranteed to have bigger revs than older, you could
glob('repo-*'), in to a list, sort desc, jump down (revisonsToKeep-1) and
delete every thing else in the list.
-Jeff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 27 04:16:48 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.