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


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to