Re: Repeated requests for feedback in logical standby

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Nick Cleaton <nick(at)cleaton(dot)net>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, Marko Tiikkaja <marko(at)joh(dot)to>
Subject: Re: Repeated requests for feedback in logical standby
Date: 2016-04-14 10:51:34
Message-ID: CABUevEzVcyL_p+Ck10XsK120XszvfBmfhN=LQkh8zvj7=uHYfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Apr 14, 2016 at 12:30 PM, Magnus Hagander <magnus(at)hagander(dot)net>
wrote:

>
>
> On Thu, Apr 14, 2016 at 7:34 AM, Nick Cleaton <nick(at)cleaton(dot)net> wrote:
>
>> On 12 April 2016 at 16:18, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>> >
>> > I've been running some tests, and come across a weird behavior on
>> shutdown with logical replication, 9.5.2. It seems that on shutdown, a lot
>> of extra requests for feedback are sent from the walsender.
>> >
>> > On my laptop I get about 3-15 requests (different each time), and on a
>> server with a bit more power but still very low activity, the number is
>> simply huge.
>> >
>> > Basically what happens is:
>> >
>> > * Replication works fine
>> > * I have *zero* activity on the master since it got started, not even a
>> single psql
>> > * I issue a fast shutdown on the master
>> > * Nothing happens at all for a while
>> > * Once pg_recvlogical times out and sends a status message things wake
>> up
>> > * The server sends a whole bunch of requests for status, which
>> pg_recvlogical responds to
>> > * Eventually things shut down (on the proper server, I've had to kill
>> things because it takes too long - I'm unsure if it ever shuts down)
>>
>>
>> That sounds similar to something I've seen with wal-based replication:
>>
>> http://www.postgresql.org/message-id/flat/CAFgz3kus=rC_avEgBV=+hRK5HYJ8vXskJRh8yEAbahJGTzF2VQ(at)mail(dot)gmail(dot)com#CAFgz3kus=rC_avEgBV=+hRK5HYJ8vXskJRh8yEAbahJGTzF2VQ@mail.gmail.com
>
>
> Agreed, that sounds very similar.
>
> I don't know the code enough to say whether that's a proper fix though, or
> if it might have other sideeffects.
>
>

I should add that yes, this patch does seem to remove the problem for me as
well. But I can't confirm if it breaks something else. Hopefully someone
who has worked more on that code can?

I also still see the problem that "pg_ctrl stop -m fast" on the master does
*nothing* until the client sends one message. I tried increasing the
feedback interval to 2 minutes, and that increased the shutdown time to 2
minutes as well. Which can't be right - clearly the shutdown is failing to
actually make the walsender send the request and shut down. This happens
both with and without the suggested patch.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Devrim Gündüz 2016-04-14 11:13:19 Re: BUG #14083: 'postgresql95-setup initdb' breaks inside docker container
Previous Message root 2016-04-14 10:40:53 BUG #14085: Weird generic plan in PL/pgSQL function