Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup does not work w/ PSQL + "all" databases #387

Open
itsthejb opened this issue Nov 25, 2024 · 0 comments
Open

Cleanup does not work w/ PSQL + "all" databases #387

itsthejb opened this issue Nov 25, 2024 · 0 comments
Labels

Comments

@itsthejb
Copy link

Summary

Auto cleanup functionality doesn't work with Postgres when backing up all databases, since the find command search term doesn't include the all component of backup set filenames

Steps to reproduce

Example environment:

DEBUG_MODE: TRUE
USER_DBBACKUP: 0
GROUP_DBBACKUP: 0
CONTAINER_ENABLE_MONITORING: FALSE
DEFAULT_BACKUP_BEGIN: 0 3 * * 0
DEFAULT_CLEANUP_TIME: *CLEANUP_TIME
DEFAULT_LOG_LEVEL: DEBUG
# MariaDB
DB01_TYPE: mariadb
DB01_NAME: ALL
DB01_SPLIT_DB: FALSE
DB01_HOST: mariadb
DB01_USER: root
DB01_PASS: ...
# Postgres
DB02_TYPE: pgsql
DB02_NAME: ALL
DB02_SPLIT_DB: FALSE
DB02_HOST: postgresql
DB02_USER: root
DB02_PASS: ...

In this example, MariaDB backups are deleted correctly. Example filename is mariadb_all_mariadb_20241125-122007.sql.zst. Example find command from logs is find /backup/ -type f -mmin +20160 -iname 'mariadb_all_mariadb*' -exec rm -f '{}' ';'. Note the matching -iname argument.

However, this fails for PSQL. Example backup filename is pgsql_all_postgresql_20241020-030002.sql.zst including _all_ component as with MariaDB. However, the find command is:

find /backup/ -type f -mmin +20160 -iname 'pgsql__postgresql*' -exec rm -f '{}' ';'

Note that the required all component is missing in the -iname.

What is the expected correct behavior?

The cleanup find command should use the correct backup_job_filename_base, which is pgsql_all_postgresql in this case

Relevant logs and/or screenshots

  • Base is set correctly here for backup:
    backup_job_filename_base=pgsql_${db}_${backup_job_db_host,,}
  • However, checking later in the backup log I see backup_job_filename_base=pgsql__postgresql, which clearly overwrites the previous value and is the source of the bug

Environment

  • Image version / tag: tiredofit/db-backup:latest@sha256:58d319fc4ca790543a41a831bed9bf004d262e41f1cc3ee4d52d21688dc43fbb
  • Host OS: Alpine 3.20

Complete backup log

@itsthejb itsthejb added the bug label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant