postgresqldatabase-backupsbarman

Barman restore command behavior w.r.t PITR


I have setup the Backup via rsync/SSH with WAL streaming (Scenario 2b as mentioned in barman docs) architecture with a single PostgreSQL and Barman.

I am trying to understand how PITR works with barman recover command. What would be the expected behavior if one were to specify the current time for --target-time when issuing a recover command. Would it recover up to whatever WALs barman has last received starting from the backup time up to the current time?

Thanks


Solution

  • For others who might have the same question (given the docs are not clear on this) i found the answer & it is as i expected.

    Yes it does recover up to whatever WALs barman has last received starting from the backup time up to the current time.

    Please see below console snippet for reference,

    barman@4b412c1875cd:~$ date
    Sat Aug  8 02:47:13 UTC 2020
    barman@4b412c1875cd:~$ barman recover --target-time "2020-08-08 02:31:00+00:00" postgres-source-db 20200801T030001 /var/log/barman/TESTRESTOREFORTEST 
    Starting local restore for server postgres-source-db using backup 20200801T030001
    Destination directory: /var/log/barman/TESTRESTOREFORTEST
    Doing PITR. Recovery target time: '2020-08-08 02:31:00+00:00'
    Copying the base backup.
    Copying required WAL segments.
    Generating recovery configuration
    Identify dangerous settings in destination directory.
    
    Recovery completed (start time: 2020-08-08 02:50:46.538480, elapsed time: 1 second)
    
    Your PostgreSQL server has been successfully prepared for recovery!
    barman@4b412c1875cd:~$ 
    

    Thanks