Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V8pSM-0000ob-Iv for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Aug 2013 10:34:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V8pSL-0000xY-R3 for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Aug 2013 10:34:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V8pSL-0000xS-2i for pgsql-bugs@postgresql.org; Mon, 12 Aug 2013 10:34:33 +0000 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V8pSH-0008J1-Qu for pgsql-bugs@postgresql.org; Mon, 12 Aug 2013 10:34:32 +0000 Received: by mail-pd0-f169.google.com with SMTP id r10so3275030pdi.28 for ; Mon, 12 Aug 2013 03:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=UwD+65X/QsLsFAbdrCV+ZJNoivhAKLGfMVmjfYNEn4U=; b=WPuWsV4jJKdGBDIykJVF4nauAtvH21kOd0crktVPxQy3kFF0LNneUFoNZPtMXJYtNl PeT87nDlLqXFhez1Lzj0izR7iDQXLLfprjDXYImIRPvQIJ38hpyvPher3WvU97Z4IODc QI4Ldekuu62Z7BrvQwb4QN1h6CrVU7EGqPS4myYnqEhLdAPCyE1/uFUdkrDWQ6Rx8Qyp g/3U+98Fp0pRL+QzScl1BFJ218eMKI3jsFuxIKycqc/CJ6rI7mrgD9OKunsI13o+tm3g 7gKitJt0JAz4jIAdd2iGqgrmLVvMM0rLobQzz5F8oyRE9L6JMt9XVF3nAIwzS8C5NcTw Zkyg== X-Received: by 10.68.179.65 with SMTP id de1mr23815561pbc.73.1376303667730; Mon, 12 Aug 2013 03:34:27 -0700 (PDT) Received: from [192.168.0.102] (014136185055.ctinets.com. [14.136.185.55]) by mx.google.com with ESMTPSA id ys4sm36422018pbb.9.2013.08.12.03.34.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 03:34:26 -0700 (PDT) Subject: Recovery.conf PITR by recovery_target_time Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: "ascot.moss@gmail.com" In-Reply-To: Date: Mon, 12 Aug 2013 18:34:23 +0800 Cc: ascot.moss@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <1375985902.2599.YahooMailNeo@web162904.mail.bf1.yahoo.com> <22CFCCDF-F7A3-4F5C-A3B5-5BBE01708AB8@gmail.com> To: pgsql-bugs@postgresql.org X-Mailer: Apple Mail (2.1085) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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;=09 16:35:02 HKT Begin; CREATE TABLE test23 (id INTEGER PRIMARY KEY); INSERT I= NTO test23 VALUES (generate_series(1,230000)); End; Commit; 16:57:01 HKT Begin; CREATE TABLE test24 (id INTEGER PRIMARY KEY); INSERT I= NTO test24 VALUES (generate_series(1,240000)); End; Commit; 15:57:45 HKT Begin; CREATE TABLE test25 (id INTEGER PRIMARY KEY); INSER= T INTO test25 VALUES (generate_series(1,250000)); End; Commit; 16:57:56 HKT drop table test24; ( 16:58:30 HKT <=3D=3D recovery_target_time ) 17:01:53 HKT Begin; CREATE TABLE test26 (id INTEGER PRIMARY KEY); INSERT I= NTO test26 VALUES (generate_series(1,260000)); End; Commit; b) Expected Result - Do PITR on another test machine,=20 - Set recovery_target_time =3D '2013-08-12 16:58:30 HKT', i.e wish to get = table test22, test23, test25 restored, but not test24 (dropped) / test26 (a= fter recovery_target_time) - PITR should stop the recovery according to recovery_target_time (i.e. sh= ould not replay all WAL) c) Recovery.conf (only 4 lines) restore_command =3D '/usr/local/pgsql/bin/pg_standby -d -s 2 -t /tmp/pgs= ql.trigger.5442 /var/pgsql/data/archive/ %f %p %r >> /tmp/pitr.log' recovery_end_command =3D 'rm -f /tmp/pgsql.trigger.5442' recovery_target_time =3D '2013-08-12 16:58:30 HKT' recovery_target_inclusive =3D 'false' d) Result (Not Good )=20 PG ignored the recovery_target_time, actually it just replayed all WAL= which is not good. - Log :=20 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 <=3D= =3D showing the point-in-time of the recovery=20 Trigger file: 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//00000001000000AD000000= 0B" "pg_xlog/RECOVERYXLOG" Keep archive history: 000000000000000000000000 and later running restore: OK - check tables from psql: postgres=3D# \d List of relations Schema | Name | Type | Owner=20=20=20 --------+--------+-------+---------- public | test22 | table | postgres public | test23 | table | postgres public | test25 | table | postgres public | test26 | table | postgres <=3D=3D=3D this table wa= s created at 17:01:53 and should not be restored (4 rows) postgres=3D# select count(1) from test26; count=20=20 --------- 2600000 (1 row) I am new to PITR, can you please advise if this is a bug and any work aroun= d? regards --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs