Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BE34F64FCCF; Thu, 18 Sep 2008 10:50:24 -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 98912-03; Thu, 18 Sep 2008 10:50:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128164.authsmtp.co.uk (outmail128164.authsmtp.co.uk [62.13.128.164]) by postgresql.org (Postfix) with ESMTP id 76BDB64FCBF; Thu, 18 Sep 2008 10:50:18 -0300 (ADT) Received: from punt9.authsmtp.com (punt9.authsmtp.com [62.13.128.70]) by punt2.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m8IDoGxx003481; Thu, 18 Sep 2008 14:50:16 +0100 (BST) Received: from mail-c189.authsmtp.com (mail-c189.authsmtp.com [62.13.128.71]) by punt9.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m8IDoFNC097205; Thu, 18 Sep 2008 14:50:15 +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 m8IDoDhu022002; Thu, 18 Sep 2008 14:50:14 +0100 (BST) Subject: Re: [PATCHES] Infrastructure changes for recovery From: Simon Riggs To: Tom Lane Cc: List pgsql-patches , pgsql-hackers In-Reply-To: <16992.1221743196@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> Content-Type: text/plain Date: Thu, 18 Sep 2008 14:50:47 +0100 Message-Id: <1221745847.3913.2408.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: b83075b0-8588-11dd-bc7a-001f29070be2 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadRtFaQ1bflxB HGQLW1xEUV57XGN/ ag4fZQBDYEtPQQJr TklLRE1QEQdtHhxP WxZnJkYGL0BGenxw ZUQsXHdaXgoofUV9 RUsGFXAOYG9odWEe BBRFJVBTIR5Kfh4T aFl/U3NfNGdJBC9q VzwLFgwaHRhkHWxm YigmDn8oenNDPzgy XRkZAS8yFlEYXSh7 JBwvLFERBw4fNV96 K1YqXkwVKQ56 X-Authentic-SMTP: 61633235383639.kestrel.dmpriest.net.uk:1186/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/1169 X-Sequence-Number: 124298 On Thu, 2008-09-18 at 09:06 -0400, Tom Lane wrote: > Simon Riggs writes: > > Having some trouble trying to get a clean state change from recovery to > > normal mode. > > > Startup needs to be able to write WAL at the end of recovery so it can > > write a ShutdownCheckpoint, yet must not be allowed to write WAL before > > that. Other services are still not fully up yet. So every other process > > apart from Startup musn't write WAL until Startup has fully completed > > its actions, which is sometime later. > > ... > > We *might* solve this by making the final checkpoint that Startup writes > > into an online checkpoint. > > Do we really need a checkpoint there at all? I can't recall right now > if there was a good reason why Vadim made it do that. I have a feeling > that it might have had to do with an assumption that the recovery > environment was completely distinct from live environment; which is a > statement that's certainly not going to be true in a query-answering > slave. Hmm, a question I hadn't considered. We definitely don't want to do PreallocXlogFiles(). "Timelines only change at shutdown checkpoints". But its just as easy to write a short timeline change record rather than the checkpoint itself, so we can sort that out. It should be sufficient to request bgwriter to perform an immediate checkpoint, rather than have startup process perform it. That way startup can exit and we can change to normal processing faster. If we crash before the next checkpoint then we would revert to archive recovery or crash recovery. The last restartpoint might well be somewhere else. In streaming mode we would presumably have that data locally, so not really a problem. But we musn't mark control file in production yet, but we can do so following the next checkpoint. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support