pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders
Date: Sun, 23 Apr 2017 22:53:15 -0400
Message-ID: <10700.1493002395@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEepm=1KQyN+jd+r9X9L2D1zQhH+yofaoUQzVpTBhKm4NG90Yw@mail.gmail.com>
References: <20170421190629.3srqyohjocgdvhhr@alvherre.pgsql>
	<27895.1492808648@sss.pgh.pa.us>
	<CAEepm=3N59Qi=Mo0mb1SmHVdEryb+jdtqEvmsp60bBVBeF+eVQ@mail.gmail.com>
	<CANP8+jKwXbP8642zwZb==fQcqcLD-Fc1jEcivCqmEh0z4LUS6w@mail.gmail.com>
	<CAEepm=1-QRkb3Y+hO+tQVyKqH9dp0GVVWkMmsMDy1izpVZ4XLw@mail.gmail.com>
	<4219.1492875661@sss.pgh.pa.us>
	<CAEepm=1J1PxBjUNthkjc__mZLgO4T-huK6tSoSAdCz+vuy2Y5A@mail.gmail.com>
	<300.1492927294@sss.pgh.pa.us>
	<CAEepm=1KQyN+jd+r9X9L2D1zQhH+yofaoUQzVpTBhKm4NG90Yw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Thomas Munro <thomas.munro@enterprisedb.com> writes:
> On Sun, Apr 23, 2017 at 6:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Fair enough.  But I'd still like an explanation of why only about
>> half of the population is showing a failure here.  Seems like every
>> machine should be seeing the LSN as moving backwards in this test.
>> So (a) why aren't they all failing, and (b) should we change the
>> test to make sure every platform sees that happening?

> Every machine sees the LSN moving backwards, but the code path that
> had the assertion only reached if it decides to interpolate, which is
> timing dependent: there needs to be a future sample in the lag
> tracking buffer, which I guess is not the case in those runs.

I'm dissatisfied with this explanation because if it's just timing,
it doesn't seem very likely that some machines would reproduce the
failure every single time while others never would.  Maybe that can be
blamed on kernel scheduler vagaries + different numbers of cores, but
I can't escape the feeling that there's something here we've not
fully understood.

While chasing after this earlier today, I turned on some debug logging
and noted that the standby's reports look like

2017-04-23 15:46:46.206 EDT [34829] LOG:  database system is ready to accept read only connections
2017-04-23 15:46:46.212 EDT [34834] LOG:  fetching timeline history file for timeline 2 from primary server
2017-04-23 15:46:46.212 EDT [34834] LOG:  started streaming WAL from primary at 0/3000000 on timeline 1
2017-04-23 15:46:46.213 EDT [34834] LOG:  sending write 0/3020000 flush 0/3028470 apply 0/3028470
2017-04-23 15:46:46.214 EDT [34834] LOG:  replication terminated by primary server
2017-04-23 15:46:46.214 EDT [34834] DETAIL:  End of WAL reached on timeline 1 at 0/3028470.
2017-04-23 15:46:46.214 EDT [34834] LOG:  sending write 0/3028470 flush 0/3028470 apply 0/3028470
2017-04-23 15:46:46.214 EDT [34830] LOG:  new target timeline is 2
2017-04-23 15:46:46.214 EDT [34834] LOG:  restarted WAL streaming at 0/3000000 on timeline 2
2017-04-23 15:46:46.228 EDT [34834] LOG:  sending write 0/3020000 flush 0/3028470 apply 0/3028470

So you're right that the standby's reported "write" position can go
backward, but it seems pretty darn odd that the flush and apply
positions didn't go backward too.  Is there a bug there?

I remain of the opinion that if we can't tell from the transmitted
data whether a timeline switch has caused the position to go backward,
then that's a protocol shortcoming that ought to be fixed.

			regards, tom lane


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



view thread (22+ messages)  latest in thread

Message-ID: <10700.1493002395@sss.pgh.pa.us>
Permalink:  ../10700.1493002395@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10700.1493002395@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com, simon@2ndquadrant.com, alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders
  In-Reply-To: <10700.1493002395@sss.pgh.pa.us>
  References: <20170421190629.3srqyohjocgdvhhr@alvherre.pgsql> <27895.1492808648@sss.pgh.pa.us> <CAEepm=3N59Qi=Mo0mb1SmHVdEryb+jdtqEvmsp60bBVBeF+eVQ@mail.gmail.com> <CANP8+jKwXbP8642zwZb==fQcqcLD-Fc1jEcivCqmEh0z4LUS6w@mail.gmail.com> <CAEepm=1-QRkb3Y+hO+tQVyKqH9dp0GVVWkMmsMDy1izpVZ4XLw@mail.gmail.com> <4219.1492875661@sss.pgh.pa.us> <CAEepm=1J1PxBjUNthkjc__mZLgO4T-huK6tSoSAdCz+vuy2Y5A@mail.gmail.com> <300.1492927294@sss.pgh.pa.us> <CAEepm=1KQyN+jd+r9X9L2D1zQhH+yofaoUQzVpTBhKm4NG90Yw@mail.gmail.com> <10700.1493002395@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox