Re: [PATCHES] Infrastructure changes for recovery

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: List pgsql-patches <pgsql-patches(at)postgresql(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Infrastructure changes for recovery
Date: 2008-09-22 22:06:01
Message-ID: 1222121161.4445.248.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


On Thu, 2008-09-18 at 10:09 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > On Thu, 2008-09-18 at 09:06 -0400, Tom Lane wrote:
> >> Do we really need a checkpoint there at all?
>
> > "Timelines only change at shutdown checkpoints".
>
> Hmm. I *think* that that is just a debugging crosscheck rather than a
> critical property. But yeah, it would take some close investigation,
> which maybe isn't warranted if you have a less-invasive solution.

OK, new patch, version 6. Some major differences to previous patch.

* new IsRecoveryProcessingMode() in shmem
* padding in XLogCtl to ensure above call is cheap
* specific part of bgwriter shmem for passing restartpoint data
* avoid Shutdown checkpoint at end of recovery, with carefully
considered positioning of statements (beware!)
* only one new postmaster mode, PM_RECOVERY
* bgwriter changes state without stopping/starting

Modes I have tested so far
* make check
* Start, Stop
* Crash Recovery
* Archive Recovery
* Archive Recovery, switch in middle of restartpoint

Modes not yet tested
* EXEC_BACKEND

Ready for serious review prior to commit. I will be performing further
testing also.

backend/access/transam/multixact.c | 2
backend/access/transam/xlog.c | 328 ++++++++++++---!!!!!!!!!!!!
backend/postmaster/bgwriter.c | 371 +++++---!!!!!!!!!!!!!!!!!!!!!
backend/postmaster/postmaster.c | 62 ++++!!
backend/storage/buffer/README | 5
backend/storage/buffer/bufmgr.c | 34 +!!
include/access/xlog.h | 14 !
include/access/xlog_internal.h | 3
include/catalog/pg_control.h | 2
include/postmaster/bgwriter.h | 2
include/storage/bufmgr.h | 2
include/storage/pmsignal.h | 1
12 files changed, 279 insertions(+), 56 deletions(-), 491 mods(!)

There's a few subtle points along the way. I've tried to explain them
all in code comments, but questions welcome. At v6, most things are now
done a particular way for a specific reason.

Look especially at InRecovery, which is used extensively in different
parts of the code. The meaning of this has been subdivided into two
meanings, so only *some* of the places that use it have been changed.
All have been checked.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

Attachment Content-Type Size
recovery_infrastruc.v6.patch text/x-patch 51.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2008-09-22 22:42:13 Re: [patch] fix dblink security hole
Previous Message Simon Riggs 2008-09-22 22:04:43 Re: get_relation_stats_hook()

Browse pgsql-patches by date

  From Date Subject
Next Message Alex Hunsaker 2008-09-23 01:57:16 Re: hash index improving v3
Previous Message Simon Riggs 2008-09-22 22:04:43 Re: get_relation_stats_hook()