From: Mark Dilger <hornschnorter@gmail.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders
Date: Mon, 24 Apr 2017 15:41:25 -0700
Message-ID: <4DBA9267-A668-4DC9-8908-7183ABBA3081@gmail.com> (raw)
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
> On Apr 23, 2017, at 7:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> 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.
The recent fix in 546c13e11b29a5408b9d6a6e3cca301380b47f7f has local variable overwriteOK
assigned but not used in twophase.c RecoverPreparedTransactions(void). I'm not sure if that's
future-proofing or an oversight. It seems to be used in other functions. Just FYI.
Mark Dilger
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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: hornschnorter@gmail.com, simon@2ndquadrant.com, thomas.munro@enterprisedb.com, alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org, tgl@sss.pgh.pa.us
Subject: Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders
In-Reply-To: <4DBA9267-A668-4DC9-8908-7183ABBA3081@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> <10700.1493002395@sss.pgh.pa.us> <4DBA9267-A668-4DC9-8908-7183ABBA3081@gmail.com>
* 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