Fix minor bug in logical-replication walsender shutdown
authorAlvaro Herrera <[email protected]>
Thu, 17 Oct 2019 13:06:05 +0000 (15:06 +0200)
committerAlvaro Herrera <[email protected]>
Thu, 17 Oct 2019 13:06:05 +0000 (15:06 +0200)
commitabd5071d216336e1d6451f009fce6d170c61673e
tree9089bf8f41bd1d300d88c51a7cbcf849a7d6b2a7
parent080cf32d22317591cd8891c797a4d925cf1dbda2
Fix minor bug in logical-replication walsender shutdown

Logical walsender should exit when it catches up with sending WAL during
shutdown; but there was a rare corner case when it failed to because of
a race condition that puts it back to wait for more WAL instead -- but
since there wasn't any, it'd not shut down immediately.  It would only
continue the shutdown when wal_sender_timeout terminates the sleep,
which causes annoying waits during shutdown procedure.  Restructure the
code so that we no longer forget to set WalSndCaughtUp in that case.

This was an oversight in commit c6c333436.

Backpatch all the way down to 9.4.

Author: Craig Ringer, Álvaro Herrera
Discussion: https://postgr.es/m/CAMsr+YEuz4XwZX_QmnX_-2530XhyAmnK=zCmicEnq1vLr0aZ-g@mail.gmail.com
src/backend/replication/walsender.c