aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2017-08-08 15:37:44 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2017-08-08 15:37:44 -0400
commit030273b7ea468ed4b3073dfd1f2ad88e3129df6a (patch)
tree7a1385e2de7253c79a2ee2c454fef34ba7ff8110 /src/backend
parentb4a2eea030ba74ea84335c7d5bc999f693ffd9a4 (diff)
downloadpostgresql-030273b7ea468ed4b3073dfd1f2ad88e3129df6a.tar.gz
postgresql-030273b7ea468ed4b3073dfd1f2ad88e3129df6a.zip
Fix inadequacies in recently added wait events
In commit 9915de6c1cb2, we introduced a new wait point for replication slots and incorrectly labelled it as wait event PG_WAIT_LOCK. That's wrong, so invent an appropriate new wait event instead, and document it properly. While at it, fix numerous other problems in the vicinity: - two different walreceiver wait events were being mixed up in a single wait event (which wasn't documented either); split it out so that they can be distinguished, and document the new events properly. - ParallelBitmapPopulate was documented but didn't exist. - ParallelBitmapScan was not documented (I think this should be called "ParallelBitmapScanInit" instead.) - Logical replication wait events weren't documented - various symbols had been added in dartboard order in various places. Put them in alphabetical order instead, as was originally intended. Discussion: https://postgr.es/m/20170808181131.mu4fjepuh5m75cyq@alvherre.pgsql
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/postmaster/pgstat.c36
-rw-r--r--src/backend/replication/libpqwalreceiver/libpqwalreceiver.c4
-rw-r--r--src/backend/replication/slot.c3
3 files changed, 25 insertions, 18 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index a0b0eecbd5e..3f5fb796a5e 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -3481,6 +3481,12 @@ pgstat_get_wait_activity(WaitEventActivity w)
case WAIT_EVENT_CHECKPOINTER_MAIN:
event_name = "CheckpointerMain";
break;
+ case WAIT_EVENT_LOGICAL_LAUNCHER_MAIN:
+ event_name = "LogicalLauncherMain";
+ break;
+ case WAIT_EVENT_LOGICAL_APPLY_MAIN:
+ event_name = "LogicalApplyMain";
+ break;
case WAIT_EVENT_PGSTAT_MAIN:
event_name = "PgStatMain";
break;
@@ -3502,12 +3508,6 @@ pgstat_get_wait_activity(WaitEventActivity w)
case WAIT_EVENT_WAL_WRITER_MAIN:
event_name = "WalWriterMain";
break;
- case WAIT_EVENT_LOGICAL_LAUNCHER_MAIN:
- event_name = "LogicalLauncherMain";
- break;
- case WAIT_EVENT_LOGICAL_APPLY_MAIN:
- event_name = "LogicalApplyMain";
- break;
/* no default case, so that compiler will warn */
}
@@ -3533,15 +3533,18 @@ pgstat_get_wait_client(WaitEventClient w)
case WAIT_EVENT_CLIENT_WRITE:
event_name = "ClientWrite";
break;
+ case WAIT_EVENT_LIBPQWALRECEIVER_CONNECT:
+ event_name = "LibPQWalReceiverConnect";
+ break;
+ case WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE:
+ event_name = "LibPQWalReceiverReceive";
+ break;
case WAIT_EVENT_SSL_OPEN_SERVER:
event_name = "SSLOpenServer";
break;
case WAIT_EVENT_WAL_RECEIVER_WAIT_START:
event_name = "WalReceiverWaitStart";
break;
- case WAIT_EVENT_LIBPQWALRECEIVER:
- event_name = "LibPQWalReceiver";
- break;
case WAIT_EVENT_WAL_SENDER_WAIT_WAL:
event_name = "WalSenderWaitForWAL";
break;
@@ -3579,6 +3582,12 @@ pgstat_get_wait_ipc(WaitEventIPC w)
case WAIT_EVENT_EXECUTE_GATHER:
event_name = "ExecuteGather";
break;
+ case WAIT_EVENT_LOGICAL_SYNC_DATA:
+ event_name = "LogicalSyncData";
+ break;
+ case WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE:
+ event_name = "LogicalSyncStateChange";
+ break;
case WAIT_EVENT_MQ_INTERNAL:
event_name = "MessageQueueInternal";
break;
@@ -3600,18 +3609,15 @@ pgstat_get_wait_ipc(WaitEventIPC w)
case WAIT_EVENT_PROCARRAY_GROUP_UPDATE:
event_name = "ProcArrayGroupUpdate";
break;
+ case WAIT_EVENT_REPLICATION_SLOT_DROP:
+ event_name = "ReplicationSlotDrop";
+ break;
case WAIT_EVENT_SAFE_SNAPSHOT:
event_name = "SafeSnapshot";
break;
case WAIT_EVENT_SYNC_REP:
event_name = "SyncRep";
break;
- case WAIT_EVENT_LOGICAL_SYNC_DATA:
- event_name = "LogicalSyncData";
- break;
- case WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE:
- event_name = "LogicalSyncStateChange";
- break;
/* no default case, so that compiler will warn */
}
diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
index 93dd7b5c176..de03362c91c 100644
--- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
+++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
@@ -181,7 +181,7 @@ libpqrcv_connect(const char *conninfo, bool logical, const char *appname,
WL_LATCH_SET | io_flag,
PQsocket(conn->streamConn),
0,
- WAIT_EVENT_LIBPQWALRECEIVER);
+ WAIT_EVENT_LIBPQWALRECEIVER_CONNECT);
/* Emergency bailout? */
if (rc & WL_POSTMASTER_DEATH)
@@ -582,7 +582,7 @@ libpqrcv_PQexec(PGconn *streamConn, const char *query)
WL_LATCH_SET,
PQsocket(streamConn),
0,
- WAIT_EVENT_LIBPQWALRECEIVER);
+ WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE);
/* Emergency bailout? */
if (rc & WL_POSTMASTER_DEATH)
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 08c0b1b285f..63e1aaa9102 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -391,7 +391,8 @@ retry:
name, active_pid)));
/* Wait here until we get signaled, and then restart */
- ConditionVariableSleep(&slot->active_cv, PG_WAIT_LOCK);
+ ConditionVariableSleep(&slot->active_cv,
+ WAIT_EVENT_REPLICATION_SLOT_DROP);
ConditionVariableCancelSleep();
goto retry;
}