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

bad behavior of --keep-data-generations 0 #206

Open
thoshiai opened this issue Oct 14, 2021 · 3 comments
Open

bad behavior of --keep-data-generations 0 #206

thoshiai opened this issue Oct 14, 2021 · 3 comments

Comments

@thoshiai
Copy link

When pg_rman backup with --keep-data-generations 0, all backup that
contain current backup is deleted. The cause of this behavior is that
pg_rman allow for KEEP_DATA_GENERATIONS to 0.

 $ psql --version
 psql (PostgreSQL) 13.1
 $ pg_rman --version
 pg_rman 1.3.13
 
 $ pg_rman backup -b full -d postgres --keep-data-generations 1
 INFO: copying database files
 INFO: copying archived WAL files
 INFO: backup complete
 INFO: Please execute 'pg_rman validate' to verify the files are correctly copied.
 INFO: start deleting old backup (keep generations = 1)
 INFO: does not include the backup just taken 
$ pg_rman show
 =====================================================================
  StartTime           EndTime              Mode    Size   TLI  Status
 =====================================================================
 2021-10-14 12:37:40  2021-10-14 12:37:42  FULL   352MB     1  DONE
 $ pg_rman backup -b full -d postgres --keep-data-generations 0
 INFO: copying database files
 INFO: copying archived WAL files
 INFO: backup complete
 INFO: Please execute 'pg_rman validate' to verify the files are correctly copied.
 INFO: start deleting old backup (keep generations = 0)
 INFO: delete the backup with start time: "2021-10-14 12:37:53"
 INFO: delete the backup with start time: "2021-10-14 12:37:40" 
 $ pg_rman show 
 =====================================================================
  StartTime           EndTime              Mode    Size   TLI  Status
 =====================================================================
@huangfumingyue
Copy link
Contributor

Thank you for your issue.
First, if you set --keep-data-generations to 0, deleting all backup files is the correct behavior.
And I think it's useful if the user want to delete all backup files.
According to the current specifications of pg_rman, if user want to delete all backup files,
It will takes a lot of time because user have to manually delete all the files from the backup catalog.

So, I think we will still allowing --keep-data-generations to be 0,
How about adding this case to the manual as restrictions?

@thoshiai
Copy link
Author

Thank you for your answer. I think that your idea is good!

I'm worried about the behavior when the this parameter set 0. For example,
if it sets 0, all backup file are deleted, including backup which status set DONE( not OK).
Is this behavior no problem?

@huangfumingyue
Copy link
Contributor

I think it is no probolem.
「DONE」means backup is done successfully, but we does not do validate yet.
If validation checks are not done,Only the restore and the next increment are affected.
so,If we delete all backup files including backup files with status 'DONE',
the next time you get the full backup, there is no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants