pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Why I lost the last pg_xlog file?
3+ messages / 3 participants
[nested] [flat]

* Why I lost the last pg_xlog file?
@ 2011-01-27 12:10 Waldomiro <waldomiro@shx.com.br>
  2011-01-27 14:17 ` Re: Why I lost the last pg_xlog file? Shaun Thomas <sthomas@peak6.com>
  2011-01-27 14:51 ` Re: Why I lost the last pg_xlog file? Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 2 replies; 3+ messages in thread

From: Waldomiro @ 2011-01-27 12:10 UTC (permalink / raw)
  To: pgsql-performance

Hi,

Yesterday I perform a crash test, but I lost the last pg_xlog file.
Let me explain:

First I did the pg_start_backup
Second I copied the phisical files to the slave server
Third I did the pg_stop_backup

So I run a test,

1) In the master server I created a 100.000 records table
2) I Runned the "checkpoint" command to be sure the table will be saved.
3) I check the pg_xlog, there was created 6 logs, but in the archive 
there was only 5.
4) I copied the achives files to the slave server and I created a 
recovery.conf and started the slave postgres.
5) Postgres recovered the 5 log files correctly,  but the new table did 
not came to the slave. I think because the last pg_xlog file was not 
archived.

I did not understand why the last file wasnt archieved?
There is a command to be sure all pg_xlog is archived? or I need to copy 
the last file to the slave before recovery?

How is the correctly way to perform a recovery in this case?

Thanks,

Waldomiro Caraiani




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Why I lost the last pg_xlog file?
  2011-01-27 12:10 Why I lost the last pg_xlog file? Waldomiro <waldomiro@shx.com.br>
@ 2011-01-27 14:17 ` Shaun Thomas <sthomas@peak6.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Shaun Thomas @ 2011-01-27 14:17 UTC (permalink / raw)
  To: Waldomiro <waldomiro@shx.com.br>; +Cc: pgsql-performance

On 01/27/2011 06:10 AM, Waldomiro wrote:

> 3) I check the pg_xlog, there was created 6 logs, but in the archive
> there was only 5.

xlogs are only "archived" when they'd normally be deleted. If you have 
really high data turnover or very frequent checkpoints, that effectively 
happens constantly. I'm not sure where the cutoff is, but there's a 
certain amount of "reserve" xlog space based on your checkpoint_segments 
setting.

It is an archive, after all. pg_start_backup/pg_stop_backup ensure your 
backup is consistent, nothing else. Depending on your archives to 
capture everything isn't going to work. If you really want everything, 
you can either copy the xlogs manually (not safe) or initiate another 
backup. You can kinda fudge it doing this:

1. Call pg_current_xlog_location to get the current xlog.
2. Call pg_switch_xlog to force a new xlog.
3. Copy the file from step 1 and anything older than it to your 
archive/slave. Doing this *may* confuse the built-in archive system if 
your archive_command is too strict.
4. Profit.

-- 
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
312-676-8870
sthomas@peak6.com

______________________________________________

See  http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Why I lost the last pg_xlog file?
  2011-01-27 12:10 Why I lost the last pg_xlog file? Waldomiro <waldomiro@shx.com.br>
@ 2011-01-27 14:51 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  1 sibling, 0 replies; 3+ messages in thread

From: Kevin Grittner @ 2011-01-27 14:51 UTC (permalink / raw)
  To: pgsql-performance; Waldomiro <waldomiro@shx.com.br>

Waldomiro <waldomiro@shx.com.br> wrote:
 
> Yesterday I perform a crash test, but I lost the last pg_xlog
> file.
 
Did you follow the steps laid out in the documentation?:
 
http://www.postgresql.org/docs/current/interactive/continuous-archiving.html#BACKUP-PITR-RECOVERY
 
In particular, I'm wondering if you followed steps 2 and 6 properly.
 
-Kevin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-01-27 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 12:10 Why I lost the last pg_xlog file? Waldomiro <waldomiro@shx.com.br>
2011-01-27 14:17 ` Shaun Thomas <sthomas@peak6.com>
2011-01-27 14:51 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox