I configured a basebackup on a Postgres 9.5 server, specifying that the xlogs should be fetched, and that the file will be a compressed tar archive. I configured this basebackup to run on my standby server filesystem (which was setup with postgres internal streaming asynchronous replication).

Details as follows:

archive_mode = off
max_wal_senders = 5
pg_basebackup -U postgres -D - -Ft -Xf -z  > mycompressed.tar.gz

When I unpacked my tar file, the pg_xlog directory (which is setup as a physical directory, not a link) is empty, though the backup completion was clean. I can get the DB to come up, but I get OID not found errors when I select some objects, indicating an inconsistent state. Am I missing something?

Note: When I run this procedure on the master, there are no issues at all, and all of the WAL files are captured in the tar file.

  • What OS are you using? Is your pg_xlog directory a symbolic link or mount point or anything other than a bog standard directory? Are you sure it ended cleanly? Could you show us the output (to stderr) of the pg_basebackup command, as the well as the output of tar -tvf mycompressed.tar.gz |tail – jjanes Sep 1 '17 at 16:53
  • Thanks for your comment. I've amended the original question to provide more detail. – ITGuy Sep 1 '17 at 21:22
  • I still can't reproduce this with your updated command and using a "cascaded" replica as the source. Either I get the xlog files I need, or I get an error message saying it can't retrieve them (if it took longer and they are no longer available). Also, without the pg_xlog you should not be able to bring the cluster up at all, without resorting to something desperate like pg_resetxlog. Are you sure that pg_basebackup is the correct version? – jjanes Sep 4 '17 at 19:29
  • Yes, I am using there version of pg_basebackup that came with my 9.5 version. When I unpacked the tar file, there were no files in the pg_xlog directory, so maybe there was failure without it being logged. Yes, I did in fact use pg_resetxlog since the xlogs were not included in the tar. So at this point, the question seems to be, why did it not include the xlogs. – ITGuy Sep 5 '17 at 20:48
  • You probably do not need the answer by now but for others - I use pg_basebackup quite often but I always let it create files on its own. So for simple PG installation I get 2 files - base.tar and pg_xlog.tar. Program writes into pg_xlog.tar new WAL logs whole the time during the backup. So I recommend to let pg_basebackup to create files as usual. – JosMac Dec 7 '17 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.