ThisTimeLineID in checkpointer and bgwriter processes

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: ThisTimeLineID in checkpointer and bgwriter processes
Date: 2012-12-19 16:00:19
Message-ID: 50D1E493.3040800@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In both checkpointer.c and bgwriter.c, we do this before entering the
main loop:

/*
* Use the recovery target timeline ID during recovery
*/
if (RecoveryInProgress())
ThisTimeLineID = GetRecoveryTargetTLI();

That seems reasonable. However, since it's only done once, when the
process starts up, ThisTimeLineID is never updated in those processes,
even though the startup process changes recovery target timeline.

That actually seems harmless to me, and I also haven't heard of any
complaints of misbehavior in 9.1 or 9.2 caused by that. I'm not sure why
we bother to set ThisTimeLineID in those processes in the first place. I
think we did it when streaming replication was introduced because it was
an easy thing to do, because back then recovery target timeline never
changed after recovery was started. But now that it can change, I don't
think that makes sense anymore.

So, I propose that we simply remove those, and leave ThisTimeLineID at
zero in checkpointer and bgwriter processes, while we're still in
recovery. ThisTimeLineID is updated anyway before performing the first
checkpoint after finishing recovery, and AFAICS that's the first time
the value is needed.

- Heikki

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2012-12-19 16:09:00 Re: [ADMIN] Problems with enums after pg_upgrade
Previous Message Pavan Deolasee 2012-12-19 15:56:57 Re: Set visibility map bit after HOT prune