[ZODB-Dev] repozo delete_old_backups

DJL djl at ukr.net
Fri Sep 17 06:42:52 EDT 2010


sugest to add the lines like this:

def delete_old_backups(options):
    # Delete all full backup files except for the most recent full
backup file
    all = filter(is_data_file, os.listdir(options.repository))
    all.sort()

    deletable = []
    full = []
    for fname in all:
        root, ext = os.path.splitext(fname)
        if ext in ('.fs', '.fsz'):
            full.append(fname)
        if ext in ('.fs', '.fsz', '.deltafs', '.deltafsz'):
            deletable.append(fname)

    # keep most recent full
    if not full:
        return

    recentfull = full.pop(-1)
    deletable.remove(recentfull)
    root, ext = os.path.splitext(recentfull)

    dat = root + '.dat'
    if dat in deletable:
        deletable.remove(dat)

+   ind = root + '.index'
+   if ind in deletable:
+       deletable.remove(ind)

    for fname in deletable:
        log('removing old backup file %s (and .dat)', fname)
        root, ext = os.path.splitext(fname)
        try:
            os.unlink(os.path.join(options.repository, root + '.dat'))
+           os.unlink(os.path.join(options.repository, root + '.index'))
        except OSError:
            pass
        os.unlink(os.path.join(options.repository, fname))

-------- Original Message  --------
Subject: [ZODB-Dev] repozo delete_old_backups
From: DJL <djl at ukr.net>
To: zodb-dev <zodb-dev at zope.org>
Date: 09/17/2010 01:04 PM
> repozo delete_old_backups does not delete old index files
>
>
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> https://mail.zope.org/mailman/listinfo/zodb-dev
>
>
>
>   




More information about the ZODB-Dev mailing list