On 21.01.2013 09:14, Миша Тюрин wrote:
   Is there any reason why pg_basebackup has limitation in an online backup from the 
standby: "The backup history file is not created in the database cluster backed 
up." ?

WAL archiving isn't active in a standby, so even if it created a backup history file, it wouldn't go anywhere. Also, the way the backup history files are named, if you take a backup on the master at the same time (or another backup at the same time in the standby), you would end up with multiple backup history files with the same name.

   So i can't get last xlog file needed to restore :(

Good point. That was an oversight in the patch that allowed base backups from a standby.

   Also maybe i can use something like ( pg_last_xlog_replay_location() + 1 ) 
after pg_basebackup finished.

Yeah, that should work.

   Does anybody know true way to getting last xlog file in case of applying 
pg_basebackup to standby?
   How pg_basebackup gets last xlog file in case of standby and -x option?

The server returns the begin and end WAL locations to pg_basebackup, pg_basebackup just doesn't normally print them out to the user. In verbose mode, it does actually print them out, but only with -x, so that doesn't help you either. If you can compile from source, you could modify pg_basebackup.c to print the locations without -x and --verbose, search lines that print out "transaction log start point / end position".

As a workaround, without modifying the source, you can do this after pg_basebackup has finished, to get the first WAL file you need:

$ pg_controldata backupdir | grep "REDO WAL file"
Latest checkpoint's REDO WAL file:    000000030000000000000009

And as you suggested, pg_last_xlog_replay_location() for the last WAL file you need.

- Heikki


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to