Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7AD3B37BFE7; Mon, 29 Sep 2008 12:05:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 65470-06; Mon, 29 Sep 2008 12:05:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail137088.authsmtp.co.uk (outmail137088.authsmtp.co.uk [62.13.137.88]) by postgresql.org (Postfix) with ESMTP id 8161837BCA1; Mon, 29 Sep 2008 12:05:28 -0300 (ADT) Received: from punt9.authsmtp.com (punt9.authsmtp.com [62.13.128.70]) by punt4.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m8TF5R1Q055483; Mon, 29 Sep 2008 16:05:27 +0100 (BST) Received: from mail-c188.authsmtp.com (mail-c188.authsmtp.com [62.13.128.25]) by punt9.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m8TF5Q6Y058402; Mon, 29 Sep 2008 16:05:26 +0100 (BST) Received: from [192.168.0.3] (85-211-71-126.dyn.gotadsl.co.uk [85.211.71.126]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m8TF5PfT043050; Mon, 29 Sep 2008 16:05:25 +0100 (BST) Subject: Re: [PATCHES] Infrastructure changes for recovery From: Simon Riggs To: Tom Lane Cc: List pgsql-patches , pgsql-hackers In-Reply-To: <11540.1222697639@sss.pgh.pa.us> References: <1218109459.4549.423.camel@ebony.2ndQuadrant> <1220213074.4371.173.camel@ebony.2ndQuadrant> <1905.1220895241@sss.pgh.pa.us> <1221080797.3913.768.camel@ebony.2ndQuadrant> <15776.1221594318@sss.pgh.pa.us> <1221725145.3913.2315.camel@ebony.2ndQuadrant> <16992.1221743196@sss.pgh.pa.us> <1221745847.3913.2408.camel@ebony.2ndQuadrant> <18549.1221746983@sss.pgh.pa.us> <1222121161.4445.248.camel@ebony.2ndQuadrant> <1222184541.4445.400.camel@ebony.2ndQuadrant> <28973.1222381719@sss.pgh.pa.us> <1222424415.4445.917.camel@ebony.2ndQuadrant> <9794.1222624945@sss.pgh.pa.us> <1222649659.4445.1061.camel@ebony.2ndQuadrant> <22856.1222650961@sss.pgh.pa.us> <1222691596.4445.1188.camel@ebony.2ndQuadrant> <10307.1222692406@sss.pgh.pa.us> <1222696408.4445.1229.camel@ebony.2ndQuadrant> <11540.1222697639@sss.pgh.pa.us> Content-Type: text/plain Date: Mon, 29 Sep 2008 16:06:44 +0100 Message-Id: <1222700804.4445.1271.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 0c088437-8e38-11dd-aecc-001871e930f4 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFagxbflxB HGQLW1xEUVt7WWZ/ aQwfZQBDYEtPQQJr TklLRE1QEQdtHhxP WxZ6JBwSIWFGfH1w YEYsXXJeWQp6JkZ1 SkpXEnAOMGRodWEe BBRFJlYHIx5Kfh5N bVEqXXANN2FJBC9q VzwLFgwaHRhkHWxm YigmDn8oenNDPzgy XRkZAS8yFlEYXSh7 JBwvLFERBw4fNV96 K1YqXkwVKQ56 X-Authentic-SMTP: 61633235383639.cat.dmpriest.net.uk:1378/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/1809 X-Sequence-Number: 124938 On Mon, 2008-09-29 at 10:13 -0400, Tom Lane wrote: > Simon Riggs writes: > > I think we can get away with writing the LSN value to disk, as you > > suggested, but only every so often. No need to do it after every WAL > > record, just consistently every so often, so it gives us a point at > > which we know we are safe. > > Huh? How does that make you safe? What you need to know is the max > LSN that could possibly be on disk. > > Hmm, actually we could get away with tying this to fetching WAL files > from the archive. When switching to a new WAL file, write out the > *ending* WAL address of that file to pg_control. Then process the WAL > records in it. Whether or not any of the affected pages get to disk, > we know that there is no LSN on disk exceeding what we already put in > pg_control. If we crash and restart, we'll have to get to the end > of this file before we start letting backends in; which might be further > than we actually got before the crash, but not too much further because > we already know the whole WAL file is available. > > Or is that the same thing you were saying? The detail about using > the end address seems fairly critical, and you didn't mention it... Same! Just said safe point was "LSN + 1", and since end = next start. Looks we've got a solution, no matter how it's described. (I actually have a more detailed proof of safety using snapshots/MVCC considerations so I wasn't overly worried but what we've discussed is much easier to understand and agree. Proof of safety is all we need, and this simpler proof is more secure.) Don't want to make it per file though. Big systems can whizz through WAL files very quickly, so we either make it a big number e.g. 255 files per xlogid, or we make it settable (and recorded in pg_control). -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support