Skip to content

'ERROR: Not going to purge WAL because LSN is invalid' when there is backup with ERROR state #103

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

Closed
alexign opened this issue Jul 26, 2019 · 3 comments
Milestone

Comments

@alexign
Copy link

alexign commented Jul 26, 2019

Got some strange behavior when by error make DELTA backup before any FULL in stream remote mode

root@backupserver:~/backup-tools# pg_probackup-10 show -B /backup/postgresql/backup --instance database
==============================================================================================================
 Instance  Version  ID  Recovery Time  Mode  WAL  Current/Parent TLI  Time  Data  Start LSN  Stop LSN  Status
==============================================================================================================
root@backupserver:~/backup-tools#

backupserver:~/backup-tools# pg_probackup-10 \
>         backup \
>         -B \
>         /backup/postgresql/backup \
>         --stream \
>         -j \
>         1 \
>         --retention-redundancy=14 \
>         --delete-expired \
>         --delete-wal \
>         --instance \
>         database \
>         --remote-host \
>         databaseserver \
>         --remote-user \
>         postgres \
>         -U \
>         probackup \
>         -d \
>         pg_probackup \
>         --log-level-file=verbose \
>         --log-filename=database-20190726T182724.log \
>         --log-directory=/backup/postgresql/backup/log/database \
>         --log-rotation-age=0 \
>         --ssh-options='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5' \
>         --compress \
>         --compress-level \
>         1 \
>         --backup-mode=DELTA
INFO: Backup start, pg_probackup version: 2.1.3, backup ID: PV9J42, backup mode: delta, instance: database, stream: true, remote true
ERROR: Valid backup on current timeline is not found. Create new FULL backup before an incremental one.
WARNING: Backup PV9J42 is running, setting its status to ERROR

backupserver:~/backup-tools# pg_probackup-10 show -B /backup/postgresql/backup --instance database
=======================================================================================================================
 Instance   Version  ID      Recovery Time  Mode   WAL     Current/Parent TLI  Time  Data  Start LSN  Stop LSN  Status
=======================================================================================================================
 database  10       PV9J42  ----           DELTA  STREAM  1 / 0                 0s    0B        0/0       0/0  ERROR

backupserver:~/backup-tools# pg_probackup-10 \
>         backup \
>         -B \
>         /backup/postgresql/backup \
>         --stream \
>         -j \
>         1 \
>         --retention-redundancy=14 \
>         --delete-expired \
>         --delete-wal \
>         --instance \
>         database \
>         --remote-host \
>         databaseserver \
>         --remote-user \
>         postgres \
>         -U \
>         probackup \
>         -d \
>         pg_probackup \
>         --log-level-file=verbose \
>         --log-filename=database-20190726T182724.log \
>         --log-directory=/backup/postgresql/backup/log/database \
>         --log-rotation-age=0 \
>         --ssh-options='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5' \
>         --compress \
>         --compress-level \
>         1 \
>         --backup-mode=FULL
INFO: Backup start, pg_probackup version: 2.1.3, backup ID: PV9J61, backup mode: full, instance: database, stream: true, remote true
INFO: Start transfering data files
INFO: Data files are transfered
INFO: wait for pg_stop_backup()
INFO: pg_stop backup() successfully executed
INFO: Validating backup PV9J61
INFO: Backup PV9J61 data files are valid
INFO: Backup PV9J61 completed
INFO: Evaluate backups by retention
INFO: Backup PV9J61, mode: FULL, status: OK. Redundancy: 1/14, Time Window: 0.00d/0d. Active
INFO: Backup PV9J42, mode: DELTA, status: ERROR. Redundancy: 2/14, Time Window: 0.00d/0d. Active
ERROR: Not going to purge WAL because LSN is invalid
backupserver:~/backup-tools# echo $?
1
root@backupserver:~/backup-tools# pg_probackup-10 show -B /backup/postgresql/backup --instance database
====================================================================================================================================
 Instance   Version  ID      Recovery Time           Mode   WAL     Current/Parent TLI  Time   Data   Start LSN    Stop LSN  Status
====================================================================================================================================
 database  10       PV9J61  2019-07-26 18:54:46+00  FULL   STREAM  1 / 0                50s  296MB  4/1B000028  4/1B00BD50  OK
 database  10       PV9J42  ----                    DELTA  STREAM  1 / 0                 0s     0B         0/0         0/0  ERROR

so FULL backup end with return code <> 0

@gsmolk gsmolk added the bug label Jul 26, 2019
@gsmolk
Copy link
Contributor

gsmolk commented Jul 26, 2019

Definitely a bug, for WAL purge purposes we should have selected oldest backup with valid START LSN, not just oldest backup.

Thanks for the feedback!

gsmolk added a commit that referenced this issue Jul 29, 2019
@gsmolk
Copy link
Contributor

gsmolk commented Jul 29, 2019

Fixed, TODO: improve test coverage with this case.

@gsmolk gsmolk modified the milestones: 2.2.0, 2.1.6 Jul 29, 2019
gsmolk added a commit that referenced this issue Aug 5, 2019
@gsmolk
Copy link
Contributor

gsmolk commented Aug 5, 2019

Test added, merged to master

@gsmolk gsmolk modified the milestones: 2.1.6, 2.2.0 Aug 9, 2019
@gsmolk gsmolk added the fixed label Sep 18, 2019
@gsmolk gsmolk closed this as completed Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants