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

--target-tli=current is not working as expected #922

Open
JP95Git opened this issue Apr 10, 2024 · 2 comments
Open

--target-tli=current is not working as expected #922

JP95Git opened this issue Apr 10, 2024 · 2 comments

Comments

@JP95Git
Copy link

JP95Git commented Apr 10, 2024

Hi,

I am using PostgreSQL 16.1 and Barman 3.10. Backup works fine, but PITR does not work very well, as described here: #881

So I tried to use a different approach to set the recovery time and found this in the manual:

https://docs.pgbarman.org/release/3.10.0/

Barman allows you to specify a target timeline for recovery using the --target-tli option. This can be set to a numeric timeline ID or one of the special values latest (to recover to the most recent timeline in the WAL archive) and current (to recover to the timeline which was current when the backup was taken).

So I had a bunch of backups, created with
/path/to/barman --config /path/to/barman.conf backup --wait localhost

I created some tables for testing and created another backup. My idea was to restore the previous backup to get the database without the recently created tables.

/path/to/barman --config /path/to/barman.conf recover localhost 20240410T162031 /path/to/database
Restore worked, I started PostgreSQL and the tables were still there, OK.

/path/to/barman --config /path/to/barman.conf recover localhost 20240410T162031 /path/to/database --target-tli=current
Restore worked again, I started PostgreSQL and the tables were still there. I expected to get a database without the tables, because the tables did no exists when the backup was created. I created the tables AFTER the backup.

This issue also works with Barman 3.9.

@JP95Git JP95Git changed the title The issue still persists in Barman 3.10. Here are logs and more details. --target-tli=current is not working as expected Apr 10, 2024
@gcalacoci
Copy link
Contributor

Hi,
please help me understand better:

  1. You did a backup before creating the tables
  2. you created the tables
  3. you executed a recovery with timeline current

Right?

I'm asking because if nothing happened between step 1 and 2 that generated a timeline change, then using the current value you are asking to recover everything.

@JP95Git
Copy link
Author

JP95Git commented Apr 11, 2024

No, I tried this:

  1. Create backup
  2. Create some tables
  3. Create another backup
  4. Try to restore the database to the state before the tables were created.

Or in other words: --target-tli=current and --target-tli=latest and no --target-tli parameter at all results in the same recovery.

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