Greetings, * Meera Nair (mnair@xxxxxxxxxxxxx) wrote: > The backups we ran were all exclusive backups. You should not use exclusive backups. They've been deprecated for a long, long time and have been removed in the most recent version of PG. You really should not be trying to build your own tooling for this. Please, use an existing tool where the authors have already worked through how all of this works and understand how BACKUP_END works and how to reliably perform a backup and restore of PG. Despite the documentation seeming to imply that it's trivial to do this on your own, it really isn't. > pg_start_backup('label') returned 000000040000000200000041. Then we made a copy of data directory . > Then pg_stop_backup() was executed and it returned 000000040000000200000046. I'm really not sure what you're doing exactly, but it sure looks like the BACKUP_END in the 46 WAL file is associated with the .backup file for the backup started in the 45 segment. You have this file: 000000040000000200000045.00005AE0.backup and then this is what you reported from the 46 file: rmgr: XLOG len (rec/tot): 34/ 34, tx: 0, lsn: 2/46000110, prev 2/46000098, desc: BACKUP_END 2/45005AE0 Note that the 'BACKUP_END' data content there is the starting point of the backup for which that is the BACKUP_END for- 2/45005AE0. That matches with a backup being started in the 45 file and matches the start time of the .backup file that you have in the archive. That's why the restore of the backup started in the 41 segment isn't picking up on the BACKUP_END in the 46 file as being the one matching that backup- because that's from some other backup. > To verify the copied data is restorable, we stopped server. Renamed data and archive log directories. > Replaced it with data and archive log directories copied earlier. In archive log directory logs from 41 to 49 is present. The pg_wal dir can and should be empty at the start. > Created recovery.signal and added restore_command to postgresql.conf file. And tried to start server. this failed with error in previous mail. The restore_command should be copying WAL files from the location where they were stored by the archive_command. Thanks, Stephen
Attachment:
signature.asc
Description: PGP signature