You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Edmund Lian <el...@inbrief.net> on 2003/02/27 01:53:49 UTC

Bug in hot-backup.py

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?

...Edmund.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in hot-backup.py

Posted by Michael <mi...@ispwest.com>.
Edmund Lian writes:
 > 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:

Fixed in 0.18.1 released today.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in hot-backup.py

Posted by Jeff Hinrichs <je...@delasco.com>.
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