Re: standby apply lag on inactive servers

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: alvherre(at)2ndquadrant(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: standby apply lag on inactive servers
Date: 2020-01-29 05:03:14
Message-ID: 20200129.140314.373543067995231853.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Tue, 28 Jan 2020 11:18:14 -0300, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote in
> > xlog.c:7329: (similar code exists at line 9332)
> > > ereport(LOG,
> > > (errmsg("redo done at %X/%X",
> > > (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));
> > > xtime = GetLatestXTime();
> > > if (xtime)
> > > ereport(LOG,
> > > (errmsg("last completed transaction was at log time %s",
> > > timestamptz_to_str(xtime))));
> >
> > This code assumes (and the name GetLatestXTime() suggests, I first
> > noticed that here..) that the timestamp comes from commit/abort logs,
> > so otherwise it shows a wrong timestamp. We shouldn't update the
> > variable by other than that kind of records.
>
> Hmm, that's terrible. GetLatestXTime() being displayed user-visibly for
> "last transaction completion" but having it include unrelated things
> such as restore points is terrible. One idea is to should split it in
> two: one exclusively for transaction commit/abort, and another for all
> WAL activity. That way, the former can be used for that message, and
> the latter for standby replay reports. However, that might be
> overengineering, if the only thing that the former is that one LOG
> message; instead changing the log message to state that the time is for
> other activity, as you suggest, is simpler and has no downside that I
> can see.

Perhaps we can use ControlData->checkPointCopy.time instead. It misses
checkpoint records intermittently but works in general.

But as more significant issue, nowadays PostgreSQL doesn't run a
checkpoint if it is really inactive (that is, if no "important" WAL
records have issued.).

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2020-01-29 06:02:13 Re: making the backend's json parser work in frontend code
Previous Message Kyotaro Horiguchi 2020-01-29 04:52:58 Re: standby apply lag on inactive servers