Re: ThisTimeLineID in checkpointer and bgwriter processes

From: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
To: "'Heikki Linnakangas'" <hlinnakangas(at)vmware(dot)com>
Cc: "'PostgreSQL-development'" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: ThisTimeLineID in checkpointer and bgwriter processes
Date: 2012-12-20 13:19:37
Message-ID: 006d01cddeb4$a9b45620$fd1d0260$@kapila@huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thursday, December 20, 2012 5:12 PM Heikki Linnakangas wrote:
> On 20.12.2012 12:08, Amit Kapila wrote:
> > On Wednesday, December 19, 2012 9:30 PM Heikki Linnakangas wrote:
> >> 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.
> >
> > This is used in RemoveOldXlogFiles(), so if during recovery when it's
> not
> > set and
> > this function gets called, it might have some problem.
> > I think it could get called from CreateRestartPoint() during
> recovery.
>
> Hmm, right, it's used for this:
>
> XLogFileName(lastoff, ThisTimeLineID, segno);
>
>
> So I think we're good on that front. But I'll add a comment there, and
> use 0 explicitly instead of ThisTimeLineID, for clarity.

True, it might not have any functionality effect in RemoveOldXlogFiles().
However it can be used in PreallocXlogFiles()->XLogFileInit() as well.

With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-12-20 13:32:36 Re: ThisTimeLineID in checkpointer and bgwriter processes
Previous Message Robert Haas 2012-12-20 13:04:12 Re: Cascading replication: should we detect/prevent cycles?