pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Recovery.conf and PITR
7+ messages / 4 participants
[nested] [flat]

* Recovery.conf and PITR
@ 2013-08-09 08:09 ascot.moss@gmail.com <ascot.moss@gmail.com>
  2013-08-09 08:41 ` Re: Recovery.conf and PITR Gabriele Bartolini <Gabriele.Bartolini@2ndQuadrant.it>
  2013-08-09 08:49 ` Re: Recovery.conf and PITR Luca Ferrari <fluca1978@infinito.it>
  2013-08-09 10:40 ` Re: Recovery.conf and PITR wd <wd@wdicc.com>
  0 siblings, 3 replies; 7+ messages in thread

From: ascot.moss@gmail.com @ 2013-08-09 08:09 UTC (permalink / raw)
  To: PostgreSQL general <pgsql-general@postgresql.org>; +Cc: ascot.moss@gmail.com

Hi,

I am trying PITR in a test machine (same PG version 9.2.4 same O/S Ubuntu 12.04 64 bit).  All archived WAL files are shipped and saved in /var/pgsql/data/archive, the latest transaction txid of them is 75666.  I want to recover PG at a point of time that if  XIDs are equal or smaller than '75634' so I  have the following recovery.conf (only two lines): 

restore_command = 'cp /var/pgsql/data/archive/%f %p'
recovery_target_xid = '75634'


After the restart of PG, the recovery.conf is processed and it is renamed to recovery.done.  However it restored all (75666) instead of '75634'.

postgres=# select txid_current();
 txid_current 
--------------
        75666
(1 row)


Can you please advise?

regards




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



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

* Re: Recovery.conf and PITR
  2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
@ 2013-08-09 08:41 ` Gabriele Bartolini <Gabriele.Bartolini@2ndQuadrant.it>
  2 siblings, 0 replies; 7+ messages in thread

From: Gabriele Bartolini @ 2013-08-09 08:41 UTC (permalink / raw)
  To: ascot.moss@gmail.com; +Cc: PostgreSQL general <pgsql-general@postgresql.org>

 Hello,

 On Fri, 9 Aug 2013 16:09:49 +0800, "ascot.moss@gmail.com" 
 <ascot.moss@gmail.com> wrote:
> postgres=# select txid_current();
>  txid_current
> --------------
>         75666
> (1 row)
>
>
> Can you please advise?

 WAL contains REDO log information, which means only COMMITTED 
 transactions will be recovered. Sequentiality of TXID refers to the 
 start of the transaction. Transactions can therefore be committed in a 
 different order (meaning that 75666 could for example be committed 
 before 75634 in your case).

 Remember that if you do not specify "recovery_target_inclusive = 
 false", your txid target will be included in the recovered server.

 For further information, I suggest you look at: 
 http://www.postgresql.org/docs/9.2/static/recovery-target-settings.html

 Cheers,
 Gabriele
-- 
  Gabriele Bartolini - 2ndQuadrant Italia
  PostgreSQL Training, Services and Support
  Gabriele.Bartolini@2ndQuadrant.it - www.2ndQuadrant.it


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



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

* Re: Recovery.conf and PITR
  2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
@ 2013-08-09 08:49 ` Luca Ferrari <fluca1978@infinito.it>
  2 siblings, 0 replies; 7+ messages in thread

From: Luca Ferrari @ 2013-08-09 08:49 UTC (permalink / raw)
  To: ascot.moss@gmail.com <ascot.moss@gmail.com>; +Cc: PostgreSQL general <pgsql-general@postgresql.org>

On Fri, Aug 9, 2013 at 10:09 AM, ascot.moss@gmail.com
<ascot.moss@gmail.com> wrote:
> Hi,
>
> I am trying PITR in a test machine (same PG version 9.2.4 same O/S Ubuntu 12.04 64 bit).  All archived WAL files are shipped and saved in /var/pgsql/data/archive, the latest transaction txid of them is 75666.  I want to recover PG at a point of time that if  XIDs are equal or smaller than '75634' so I  have the following recovery.conf (only two lines):
>
> restore_command = 'cp /var/pgsql/data/archive/%f %p'
> recovery_target_xid = '75634'
>
>
> After the restart of PG, the recovery.conf is processed and it is renamed to recovery.done.  However it restored all (75666) instead of '75634'.


Any chance the 75666 committed before the one you specified as target?


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

* Re: Recovery.conf and PITR
  2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
@ 2013-08-09 10:40 ` wd <wd@wdicc.com>
  2013-08-09 11:09   ` Re: Recovery.conf and PITR Luca Ferrari <fluca1978@infinito.it>
  2 siblings, 1 reply; 7+ messages in thread

From: wd @ 2013-08-09 10:40 UTC (permalink / raw)
  To: ascot.moss@gmail.com <ascot.moss@gmail.com>; +Cc: PostgreSQL general <pgsql-general@postgresql.org>

Try add these settings,

pause_at_recovery_target=true
recovery_target_inclusive=false



On Fri, Aug 9, 2013 at 4:09 PM, ascot.moss@gmail.com
<ascot.moss@gmail.com>wrote:

> Hi,
>
> I am trying PITR in a test machine (same PG version 9.2.4 same O/S Ubuntu
> 12.04 64 bit).  All archived WAL files are shipped and saved in
> /var/pgsql/data/archive, the latest transaction txid of them is 75666.  I
> want to recover PG at a point of time that if  XIDs are equal or smaller
> than '75634' so I  have the following recovery.conf (only two lines):
>
> restore_command = 'cp /var/pgsql/data/archive/%f %p'
> recovery_target_xid = '75634'
>
>
> After the restart of PG, the recovery.conf is processed and it is renamed
> to recovery.done.  However it restored all (75666) instead of '75634'.
>
> postgres=# select txid_current();
>  txid_current
> --------------
>         75666
> (1 row)
>
>
> Can you please advise?
>
> regards
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

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

* Re: Recovery.conf and PITR
  2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
  2013-08-09 10:40 ` Re: Recovery.conf and PITR wd <wd@wdicc.com>
@ 2013-08-09 11:09   ` Luca Ferrari <fluca1978@infinito.it>
  2013-08-09 12:17     ` Re: Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Luca Ferrari @ 2013-08-09 11:09 UTC (permalink / raw)
  To: PostgreSQL general <pgsql-general@postgresql.org>

On Fri, Aug 9, 2013 at 12:40 PM, wd <wd@wdicc.com> wrote:
> Try add these settings,
>
> pause_at_recovery_target=true

Be warned that this would require a manual completion of the recovery
and requires hot_standby that is not specified in the original post.

> recovery_target_inclusive=false
>

Uhm...I guess the problem is not about the txid being included or not:
the recovery target was 75634 and the transaction 75666 appeared, so
the problem seems to be an out-of-order commit of the transactions. In
such case making the inclusive false will not cause 75666 to appear if
it has committed before the target xid, or am I wrong?

Luca


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



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

* Re: Recovery.conf and PITR
  2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
  2013-08-09 10:40 ` Re: Recovery.conf and PITR wd <wd@wdicc.com>
  2013-08-09 11:09   ` Re: Recovery.conf and PITR Luca Ferrari <fluca1978@infinito.it>
@ 2013-08-09 12:17     ` ascot.moss@gmail.com <ascot.moss@gmail.com>
  2013-08-10 09:00       ` Re: Recovery.conf and PITR Luca Ferrari <fluca1978@infinito.it>
  0 siblings, 1 reply; 7+ messages in thread

From: ascot.moss@gmail.com @ 2013-08-09 12:17 UTC (permalink / raw)
  To: Luca Ferrari <fluca1978@infinito.it>; +Cc: ascot.moss@gmail.com <ascot.moss@gmail.com>; PostgreSQL general <pgsql-general@postgresql.org>


On 9 Aug 2013, at 7:09 PM, Luca Ferrari wrote:

> Uhm...I guess the problem is not about the txid being included or not:
> the recovery target was 75634 and the transaction 75666 appeared, so
> the problem seems to be an out-of-order commit of the transactions. In
> such case making the inclusive false will not cause 75666 to appear if
> it has committed before the target xid, or am I wrong?

Hi,

Is there a way to query the master (it is up and running) about the actual commit sequence by transaction IDs?

regards

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



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

* Re: Recovery.conf and PITR
  2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
  2013-08-09 10:40 ` Re: Recovery.conf and PITR wd <wd@wdicc.com>
  2013-08-09 11:09   ` Re: Recovery.conf and PITR Luca Ferrari <fluca1978@infinito.it>
  2013-08-09 12:17     ` Re: Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
@ 2013-08-10 09:00       ` Luca Ferrari <fluca1978@infinito.it>
  0 siblings, 0 replies; 7+ messages in thread

From: Luca Ferrari @ 2013-08-10 09:00 UTC (permalink / raw)
  To: ascot.moss@gmail.com <ascot.moss@gmail.com>; +Cc: PostgreSQL general <pgsql-general@postgresql.org>

On Fri, Aug 9, 2013 at 2:17 PM, ascot.moss@gmail.com
<ascot.moss@gmail.com> wrote:

> Is there a way to query the master (it is up and running) about the actual commit sequence by transaction IDs?


The information is within the clogs, but nothing comes into my mind as
to inspect from an admin point of view the clog sequence.
Anyway, I suepect it is wrong the approach you have with recovery: you
are asking the database to recover at least up to transaction x, so
why worrying about other interleaved transactions?

Luca


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



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


end of thread, other threads:[~2013-08-10 09:00 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09 08:09 Recovery.conf and PITR ascot.moss@gmail.com <ascot.moss@gmail.com>
2013-08-09 08:41 ` Gabriele Bartolini <Gabriele.Bartolini@2ndQuadrant.it>
2013-08-09 08:49 ` Luca Ferrari <fluca1978@infinito.it>
2013-08-09 10:40 ` wd <wd@wdicc.com>
2013-08-09 11:09   ` Luca Ferrari <fluca1978@infinito.it>
2013-08-09 12:17     ` ascot.moss@gmail.com <ascot.moss@gmail.com>
2013-08-10 09:00       ` Luca Ferrari <fluca1978@infinito.it>

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