Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C1E2B632187 for ; Sun, 6 Jun 2010 09:41:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 88374-07 for ; Sun, 6 Jun 2010 12:41:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from master.phlo.org (master.phlo.org [213.47.213.180]) by mail.postgresql.org (Postfix) with ESMTP id 6A9D363264A for ; Sun, 6 Jun 2010 09:41:25 -0300 (ADT) Received: (qmail 9202 invoked by uid 0); 6 Jun 2010 12:41:21 -0000 Received: from d91-128-59-49.cust.tele2.at (HELO [192.168.1.2]) (fgp@[91.128.59.49]) (envelope-sender ) by imap.phlo.org (qmail-ldap-1.03) with SMTP for ; 6 Jun 2010 12:41:21 -0000 Subject: Re: PITR Recovery Question Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Florian Pflug In-Reply-To: <00cc01cb047d$82079830$8616c890$@com> Date: Sun, 6 Jun 2010 14:41:21 +0200 Cc: Content-Transfer-Encoding: quoted-printable Message-Id: <7B83DD06-04B8-4BE5-8573-3CDD48568F1D@phlo.org> References: <001201cb0321$df429d40$9dc7d7c0$@com> <00ca01cb03dc$a9ffe780$fdffb680$@com> <00cc01cb047d$82079830$8616c890$@com> To: X-Mailer: Apple Mail (2.1078) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/60 X-Sequence-Number: 34838 On Jun 5, 2010, at 9:05 , Gnanakumar wrote: > Thanks for your valuable suggestion and a detailed step on common way = to use > PITR. Things are very clear now except that I've some other question = in > connection to this. >=20 >> The correct way to clean out pg_xlog therefore is to either disable = WAL archiving, or to make sure your archive_command succeeds eventually. >=20 > Probably I would go with the 2nd option, that is allowing archive = command to > run successfully until things are completely clear. >=20 > But this question is for my understanding: In case if I decide to go = with > 1st option, that is disable WAL archiving for a while, will it = completely > clean out files from pg_xlog/ and pg_xlog/archive_status/ directories, = so > that I can start the PITR by taking base backup by enabling WAL = archiving > later? If you disable WAL archiving by setting archive_command to 'true', it'll = surely clean out the files, since postgresql will actually believe it = archived them successfully. I not sure what happens if you set = archive_command to '' - that might disable the archiving process = completely, and hence prevent the cleanup. >> A common way to use PITR is the following. >=20 >> 4) You remove all WAL segments that predate the remaining base = backups. For that, you find the backup history file in the archive = directory that corresponds to the oldest remaining base backup and then = remove all WAL segments whose name is numerically smaller than the = from that backup history file. Keeping older WAL segments buys = you nothing - WAL files without a base backup that *predates* them are = worthless. >=20 > Can you share with me any automated shell script that takes care of = this > removal automatically? Or can you share any systematic way (steps) of = doing > things if I want to do this manually? Sorry, I don't have a script for this at hand. But a quick search = through the pgsql-admin archive brings up this post, which contains such = a script. http://archives.postgresql.org/pgsql-admin/2006-03/msg00337.php best regards, Florian Pflug