Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-05 Thread Alexander Kukushkin
On Thu, 2 May 2019 at 14:35, Tomas Vondra wrote: > >From the client side perspective, it confirmed everything that it > >should, but from the postgres side, this is not enough to shut down > >cleanly. Maybe it is possible to change the check (sentPtr == > >replicatedPtr) to something like (lastMsg

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-02 Thread Simon Riggs
On Wed, 1 May 2019 at 01:28, Tomas Vondra wrote: > Now, this situation is apparently expected, because WalSndWaitForWal() > does this: > > /* > * If we're shutting down, trigger pending WAL to be written out, > * otherwise we'd possibly end up waiting for WAL that never gets >

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-02 Thread Tomas Vondra
On Wed, May 01, 2019 at 07:12:52PM +0200, Alexander Kukushkin wrote: Hi, On Wed, 1 May 2019 at 17:02, Tomas Vondra wrote: OK, so that seems like a separate issue, somewhat unrelated to the issue I reported. And I'm not sure it's a walsender issue - it seems it might be a psycopg2 issue in not

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-01 Thread Alexander Kukushkin
Hi, On Wed, 1 May 2019 at 17:02, Tomas Vondra wrote: > OK, so that seems like a separate issue, somewhat unrelated to the issue I > reported. And I'm not sure it's a walsender issue - it seems it might be a > psycopg2 issue in not reporting the flush properly, no? Agree, it is a different issue

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-01 Thread Tomas Vondra
On Wed, May 01, 2019 at 08:53:15AM -0700, Andres Freund wrote: Hi, On 2019-05-01 02:28:45 +0200, Tomas Vondra wrote: The reason for that is pretty simple - the walsenders are doing logical decoding, and during shutdown they're waiting for WalSndCaughtUp=true. But per XLogSendLogical() this only

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-01 Thread Andres Freund
Hi, On 2019-05-01 02:28:45 +0200, Tomas Vondra wrote: > The reason for that is pretty simple - the walsenders are doing logical > decoding, and during shutdown they're waiting for WalSndCaughtUp=true. > But per XLogSendLogical() this only happens if > >if (logical_decoding_ctx->reader->EndRec

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-01 Thread Tomas Vondra
On Wed, May 01, 2019 at 02:13:10PM +0200, Alexander Kukushkin wrote: Hi Tomas, On Wed, 1 May 2019 at 02:28, Tomas Vondra wrote: I see there's an ongoing discussion about race conditions in walreceiver blocking shutdown, so let me start a new thread about a race condition in walsender during s

Re: walsender vs. XLogBackgroundFlush during shutdown

2019-05-01 Thread Alexander Kukushkin
Hi Tomas, On Wed, 1 May 2019 at 02:28, Tomas Vondra wrote: > I see there's an ongoing discussion about race conditions in walreceiver > blocking shutdown, so let me start a new thread about a race condition in > walsender during shutdown. > > The symptoms are rather simple - 'pg_ctl -m fast shu

walsender vs. XLogBackgroundFlush during shutdown

2019-04-30 Thread Tomas Vondra
Hi, I see there's an ongoing discussion about race conditions in walreceiver blocking shutdown, so let me start a new thread about a race condition in walsender during shutdown. The symptoms are rather simple - 'pg_ctl -m fast shutdown' gets stuck, waiting for walsender processes to catch-up and