summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2021-03-12 19:07:27 +1300
committerThomas Munro <tmunro@postgresql.org>2021-03-12 19:45:42 +1300
commitde829ddf23f69190efb4e0178704c4c4228e17cd (patch)
treedaf6a6291626971ffa700db0b2b2d1e4b457eaab /src/include
parent600f2f50b7a57c8481276450c9019fa7b3656411 (diff)
downloadpostgresql-de829ddf23f69190efb4e0178704c4c4228e17cd.tar.gz
Add condition variable for walreceiver shutdown.
Use this new CV to wait for walreceiver shutdown without a sleep/poll loop, while also benefiting from standard postmaster death handling. Discussion: https://postgr.es/m/CA%2BhUKGK1607VmtrDUHQXrsooU%3Dap4g4R2yaoByWOOA3m8xevUQ%40mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pgstat.h1
-rw-r--r--src/include/replication/walreceiver.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index f9166b8655..be43c04802 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -1009,6 +1009,7 @@ typedef enum
WAIT_EVENT_REPLICATION_SLOT_DROP,
WAIT_EVENT_SAFE_SNAPSHOT,
WAIT_EVENT_SYNC_REP,
+ WAIT_EVENT_WALRCV_EXIT,
WAIT_EVENT_XACT_GROUP_UPDATE
} WaitEventIPC;
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index a97a59a6a3..4fd7c25ea7 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -19,6 +19,7 @@
#include "port/atomics.h"
#include "replication/logicalproto.h"
#include "replication/walsender.h"
+#include "storage/condition_variable.h"
#include "storage/latch.h"
#include "storage/spin.h"
#include "utils/tuplestore.h"
@@ -62,6 +63,7 @@ typedef struct
*/
pid_t pid;
WalRcvState walRcvState;
+ ConditionVariable walRcvStoppedCV;
pg_time_t startTime;
/*