diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2012-10-08 13:22:04 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2012-10-08 13:32:14 +0300 |
commit | 9c0e2b918252e753ea648dd6a7c18a054bed951b (patch) | |
tree | 83e912ba5c5c294921849c1196e76d879ec90cd4 /src | |
parent | 95d035e66d8e4371d35830d81f39face03cd4c45 (diff) | |
download | postgresql-9c0e2b918252e753ea648dd6a7c18a054bed951b.tar.gz postgresql-9c0e2b918252e753ea648dd6a7c18a054bed951b.zip |
Fix walsender handling of postmaster shutdown, to not go into endless loop.
This bug was introduced by my patch to use the regular die/quickdie signal
handlers in walsender processes. I tried to make walsender exit at next
CHECK_FOR_INTERRUPTS() by setting ProcDiePending, but that's not enough, you
need to set InterruptPending too. On second thoght, it was not a very good
way to make walsender exit anyway, so use proc_exit(0) instead.
Also, send a CommandComplete message before exiting; that's what we did
before, and you get a nicer error message in the standby that way.
Reported by Thom Brown.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/walsender.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 0ba2ad44140..9207a48910b 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -711,8 +711,11 @@ WalSndLoop(void) XLogSend(output_message, &caughtup); if (caughtup && !pq_is_send_pending()) { - ProcDiePending = true; - continue; /* don't want to wait more */ + /* Inform the standby that XLOG streaming is done */ + pq_puttextmessage('C', "COPY 0"); + pq_flush(); + + proc_exit(0); } } } |