Here is what I am doing:
- I have a Postgres 16 docker container which is continuously archiving WAL files
- After
00012and00013were archived, I take a base-backup of the database usingpg_basebackupwhich generates a00014..backupfile (these are example files and actual WALs are longer I know) - Now I copy over the base backup and the archived WALs into another Postgres 16 docker container which is newly created from same docker image (including version)
- I make
postgresuser as owner for all these files - I remove the WALs from the
pg_waldirectory of base backup and update the restore_command ofpostgresql.conf(additionally I also undo the archive configs which were there on primary) - I remove
00012and00013WALs as those are already there in base backup, so now archived WALs is only00014and the .backup file created - I create a
recovery.signalfile, which is empty and in the data directory - Then finally I change the name of the current
pgdatatopgdata_iniand the backup directory aspgdataso that it acts as my data directory - Then I stop the container and start again but database startup fails due to
invalid checkpoint recordandcould not find required checkpoint record
Can someone point out what I am doing wrong here?