pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ascot.moss@gmail.com <ascot.moss@gmail.com>
To: pgsql-bugs@postgresql.org
Cc: ascot.moss@gmail.com
Subject: Recovery.conf PITR by recovery_target_time
Date: Mon, 12 Aug 2013 18:34:23 +0800
Message-ID: <B2E2466C-64B7-4749-804D-D22D0C18408F@gmail.com> (raw)
In-Reply-To: <A83C69DD-EE74-40BC-AC2C-9EA56E39B094@gmail.com>
References: <CAP-PUP0QM0ZAiz9vOpNT=WEoa_inoyVfZw2ceHAHiZAqGpSQ1w@mail.gmail.com>
	<1375985902.2599.YahooMailNeo@web162904.mail.bf1.yahoo.com>
	<CAL_0b1ubFBUEYF0oJAxshagKG+vZXJfybHpRBKuiSL=jSDxeSw@mail.gmail.com>
	<CAP-PUP1qwpyCgARqdgAhPkF0BcLnLsOO_84iLeCkHDSZrjcqRw@mail.gmail.com>
	<CAL_0b1sXizXnEynWYqni6Zc=PVGbaay3z+xG9tqbLQewnKdqqQ@mail.gmail.com>
	<D4F75986-A768-4751-A2D9-D94BE093DCDD@gmail.com>
	<CABexzmhLmBucKRr2NT4v7S8p1K0g_bZBf3436jmmpX+zwqHs1Q@mail.gmail.com>
	<CAKoxK+6jUd3Th5FG+Gm=_qB26XhODM8fHTR9wztCtf_LKJGKCQ@mail.gmail.com>
	<22CFCCDF-F7A3-4F5C-A3B5-5BBE01708AB8@gmail.com>
	<A737B7A37273E048B164557ADEF4A58B17BF74CE@ntex2010a.host.magwien.gv.at>
	<A83C69DD-EE74-40BC-AC2C-9EA56E39B094@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

I have tried following test cases about PITR:

a) Time and events on Master :
	16:32:03 HKT 	Begin; CREATE TABLE test22 (id INTEGER PRIMARY KEY); INSERT INTO test22 VALUES (generate_series(1,220000)); End; Commit;	
	16:35:02 HKT	Begin; CREATE TABLE test23 (id INTEGER PRIMARY KEY); INSERT INTO test23 VALUES (generate_series(1,230000)); End; Commit;
	16:57:01 HKT	Begin; CREATE TABLE test24 (id INTEGER PRIMARY KEY); INSERT INTO test24 VALUES (generate_series(1,240000)); End; Commit;
	15:57:45 HKT   	Begin; CREATE TABLE test25 (id INTEGER PRIMARY KEY); INSERT INTO test25 VALUES (generate_series(1,250000)); End; Commit;
	16:57:56 HKT	drop table test24;

     (	16:58:30 HKT   	<== recovery_target_time  )

	17:01:53 HKT	Begin; CREATE TABLE test26 (id INTEGER PRIMARY KEY); INSERT INTO test26 VALUES (generate_series(1,260000)); End; Commit;

b) Expected Result
	- Do PITR on another test machine, 
	- Set recovery_target_time = '2013-08-12 16:58:30 HKT', i.e wish to get table test22, test23, test25 restored, but not test24 (dropped) / test26 (after recovery_target_time)
	- PITR should stop the recovery according to recovery_target_time (i.e. should not replay all WAL)

c) Recovery.conf (only 4 lines)
	restore_command = '/usr/local/pgsql/bin/pg_standby -d -s 2  -t  /tmp/pgsql.trigger.5442  /var/pgsql/data/archive/ %f %p %r >> /tmp/pitr.log'
	recovery_end_command = 'rm -f /tmp/pgsql.trigger.5442'
	recovery_target_time = '2013-08-12 16:58:30 HKT'
	recovery_target_inclusive = 'false'


d) Result (Not Good ) 

     PG ignored the recovery_target_time, actually it just replayed all WAL which is not good.

	- Log : 
		LOG:  database system was interrupted; last known up at 2013-08-12 17:07:28 HKT
		LOG:  starting point-in-time recovery to 2013-08-12 16:58:30+08						<== showing the point-in-time of the recovery 
		Trigger file:         <not set>
		Waiting for WAL file: 00000001000000AD0000000B
		WAL file path:        /var/pgsql/data/archive//00000001000000AD0000000B
		Restoring to:         pg_xlog/RECOVERYXLOG
		Sleep interval:       2 seconds
		Max wait interval:    0 forever
		Command for restore:  cp "/var/pgsql/data/archive//00000001000000AD0000000B" "pg_xlog/RECOVERYXLOG"
		Keep archive history: 000000000000000000000000 and later
		running restore:      OK

	- check tables from psql:

		postgres=# \d
	       	 List of relations
		 Schema |  Name  | Type  |  Owner   
		--------+--------+-------+----------
 		public | test22 | table | postgres
		public | test23 | table | postgres
		public | test25 | table | postgres
 		public | test26 | table | postgres														<===	this table was created at 17:01:53 and should not be restored
		(4 rows)
		postgres=# select count(1) from test26;
		  count  
		---------
 		2600000
		(1 row)


I am new to PITR, can you please advise if this is a bug and any work around?

regards




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



view thread (3+ messages)  latest in thread

Message-ID: <B2E2466C-64B7-4749-804D-D22D0C18408F@gmail.com>
Permalink:  ../B2E2466C-64B7-4749-804D-D22D0C18408F@gmail.com/
Also on:    postgresql.org/message-id/B2E2466C-64B7-4749-804D-D22D0C18408F@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ascot.moss@gmail.com
  Subject: Re: Recovery.conf PITR by recovery_target_time
  In-Reply-To: <B2E2466C-64B7-4749-804D-D22D0C18408F@gmail.com>
  References: <CAP-PUP0QM0ZAiz9vOpNT=WEoa_inoyVfZw2ceHAHiZAqGpSQ1w@mail.gmail.com> <1375985902.2599.YahooMailNeo@web162904.mail.bf1.yahoo.com> <CAL_0b1ubFBUEYF0oJAxshagKG+vZXJfybHpRBKuiSL=jSDxeSw@mail.gmail.com> <CAP-PUP1qwpyCgARqdgAhPkF0BcLnLsOO_84iLeCkHDSZrjcqRw@mail.gmail.com> <CAL_0b1sXizXnEynWYqni6Zc=PVGbaay3z+xG9tqbLQewnKdqqQ@mail.gmail.com> <D4F75986-A768-4751-A2D9-D94BE093DCDD@gmail.com> <CABexzmhLmBucKRr2NT4v7S8p1K0g_bZBf3436jmmpX+zwqHs1Q@mail.gmail.com> <CAKoxK+6jUd3Th5FG+Gm=_qB26XhODM8fHTR9wztCtf_LKJGKCQ@mail.gmail.com> <22CFCCDF-F7A3-4F5C-A3B5-5BBE01708AB8@gmail.com> <A737B7A37273E048B164557ADEF4A58B17BF74CE@ntex2010a.host.magwien.gv.at> <A83C69DD-EE74-40BC-AC2C-9EA56E39B094@gmail.com> <B2E2466C-64B7-4749-804D-D22D0C18408F@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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