Why is pgbackrest not expiring old straggling incremental backups

877 Views Asked by At

version pgBackRest 2.19 (this is old, so I might just need to update)

We have pgbackrest set to retain the last 14 backups, and when I run pgbackrest --stanza=main info | grep 'backup:' | sort I see the last 14 full backups, but also many incremental backups that are no longer attached to a full backup. For example, the full backups listed are:

    full backup: 20210321-070002F
    full backup: 20210328-070002F
    full backup: 20210404-070001F
    full backup: 20210411-070001F
    full backup: 20210418-070001F
    full backup: 20210425-070001F
    full backup: 20210502-070001F
    full backup: 20210509-070001F
    full backup: 20210516-070001F
    full backup: 20210523-070001F
    full backup: 20210530-070001F
    full backup: 20210606-070001F
    full backup: 20210613-070001F
    full backup: 20210620-070001F

But I note many incremental backups (and they are indeed taking up space in aws s3) like:

    incr backup: 20200405-070001F_20200406-020001I
    incr backup: 20200405-070001F_20200407-020001I
    incr backup: 20200405-070001F_20200408-020001I
    etc etc...
    then ones like this, which ARE attached to the full backups that are not expired.
    incr backup: 20210620-070001F_20210624-030001I
    incr backup: 20210620-070001F_20210625-030002I

Full backups are weekly and incremental backups are daily.

I also note the wal segments in the archive folder for pgbackrest start from 20200405 (the oldest incremental backup that's not part of a full backup).

While I can choose to manually delete the backup folders and the wal segment folders older than a certain date, I would like to do so with the pgbackrest CLI instead, or at least understand what went wrong.

How can I safely delete these incremental backups that are older than the oldest retained full backup, and how can I delete the wal files out of the bpgbackrest archive folder as well? If I have to do it manually in s3, would there be consequences associated with deleting the incremental backups folders and the wal archives folders that are older than the oldest full backup?

0

There are 0 best solutions below