Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit030273b

Browse files
committed
Fix inadequacies in recently added wait events
In commit9915de6, we introduced a new wait point for replicationslots and incorrectly labelled it as wait event PG_WAIT_LOCK. That'swrong, so invent an appropriate new wait event instead, and document itproperly.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
1 parentb4a2eea commit030273b

File tree

5 files changed

+64
-27
lines changed

5 files changed

+64
-27
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
11751175
<entry><literal>CheckpointerMain</></entry>
11761176
<entry>Waiting in main loop of checkpointer process.</entry>
11771177
</row>
1178+
<row>
1179+
<entry><literal>LogicalLauncherMain</></entry>
1180+
<entry>Waiting in main loop of logical launcher process.</entry>
1181+
</row>
1182+
<row>
1183+
<entry><literal>LogicalApplyMain</></entry>
1184+
<entry>Waiting in main loop of logical apply process.</entry>
1185+
</row>
11781186
<row>
11791187
<entry><literal>PgStatMain</></entry>
11801188
<entry>Waiting in main loop of the statistics collector process.</entry>
@@ -1212,6 +1220,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
12121220
<entry><literal>ClientWrite</></entry>
12131221
<entry>Waiting to write data from the client.</entry>
12141222
</row>
1223+
<row>
1224+
<entry><literal>LibPQWalReceiverConnect</></entry>
1225+
<entry>Waiting in WAL receiver to establish connection to remote server.<entry>
1226+
</row>
1227+
<row>
1228+
<entry><literal>LibPQWalReceiverReceive</></entry>
1229+
<entry>Waiting in WAL receiver to receive data from remote server.<entry>
1230+
</row>
12151231
<row>
12161232
<entry><literal>SSLOpenServer</></entry>
12171233
<entry>Waiting for SSL while attempting connection.</entry>
@@ -1250,6 +1266,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
12501266
<entry><literal>ExecuteGather</></entry>
12511267
<entry>Waiting for activity from child process when executing <literal>Gather</> node.</entry>
12521268
</row>
1269+
<row>
1270+
<entry><literal>LogicalSyncData</></entry>
1271+
<entry>Waiting for logical replication remote server to send data for initial table synchronization.</entry>
1272+
</row>
1273+
<row>
1274+
<entry><literal>LogicalSyncStateChange</></entry>
1275+
<entry>Waiting for logical replication remote server to change state.</entry>
1276+
</row>
12531277
<row>
12541278
<entry><literal>MessageQueueInternal</></entry>
12551279
<entry>Waiting for other process to be attached in shared message queue.</entry>
@@ -1271,13 +1295,17 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
12711295
<entry>Waiting for parallel workers to finish computing.</entry>
12721296
</row>
12731297
<row>
1274-
<entry><literal>ParallelBitmapPopulate</></entry>
1275-
<entry>Waiting forthe leadertopopulate the TidBitmap.</entry>
1298+
<entry><literal>ParallelBitmapScan</></entry>
1299+
<entry>Waiting forparallel bitmap scantobecome initialized.</entry>
12761300
</row>
12771301
<row>
12781302
<entry><literal>ProcArrayGroupUpdate</></entry>
12791303
<entry>Waiting for group leader to clear transaction id at transaction end.</entry>
12801304
</row>
1305+
<row>
1306+
<entry><literal>ReplicationSlotDrop</></entry>
1307+
<entry>Waiting for a replication slot to become inactive to be dropped.</entry>
1308+
</row>
12811309
<row>
12821310
<entry><literal>SafeSnapshot</></entry>
12831311
<entry>Waiting for a snapshot for a <literal>READ ONLY DEFERRABLE</> transaction.</entry>

‎src/backend/postmaster/pgstat.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3481,6 +3481,12 @@ pgstat_get_wait_activity(WaitEventActivity w)
34813481
caseWAIT_EVENT_CHECKPOINTER_MAIN:
34823482
event_name="CheckpointerMain";
34833483
break;
3484+
caseWAIT_EVENT_LOGICAL_LAUNCHER_MAIN:
3485+
event_name="LogicalLauncherMain";
3486+
break;
3487+
caseWAIT_EVENT_LOGICAL_APPLY_MAIN:
3488+
event_name="LogicalApplyMain";
3489+
break;
34843490
caseWAIT_EVENT_PGSTAT_MAIN:
34853491
event_name="PgStatMain";
34863492
break;
@@ -3502,12 +3508,6 @@ pgstat_get_wait_activity(WaitEventActivity w)
35023508
caseWAIT_EVENT_WAL_WRITER_MAIN:
35033509
event_name="WalWriterMain";
35043510
break;
3505-
caseWAIT_EVENT_LOGICAL_LAUNCHER_MAIN:
3506-
event_name="LogicalLauncherMain";
3507-
break;
3508-
caseWAIT_EVENT_LOGICAL_APPLY_MAIN:
3509-
event_name="LogicalApplyMain";
3510-
break;
35113511
/* no default case, so that compiler will warn */
35123512
}
35133513

@@ -3533,15 +3533,18 @@ pgstat_get_wait_client(WaitEventClient w)
35333533
caseWAIT_EVENT_CLIENT_WRITE:
35343534
event_name="ClientWrite";
35353535
break;
3536+
caseWAIT_EVENT_LIBPQWALRECEIVER_CONNECT:
3537+
event_name="LibPQWalReceiverConnect";
3538+
break;
3539+
caseWAIT_EVENT_LIBPQWALRECEIVER_RECEIVE:
3540+
event_name="LibPQWalReceiverReceive";
3541+
break;
35363542
caseWAIT_EVENT_SSL_OPEN_SERVER:
35373543
event_name="SSLOpenServer";
35383544
break;
35393545
caseWAIT_EVENT_WAL_RECEIVER_WAIT_START:
35403546
event_name="WalReceiverWaitStart";
35413547
break;
3542-
caseWAIT_EVENT_LIBPQWALRECEIVER:
3543-
event_name="LibPQWalReceiver";
3544-
break;
35453548
caseWAIT_EVENT_WAL_SENDER_WAIT_WAL:
35463549
event_name="WalSenderWaitForWAL";
35473550
break;
@@ -3579,6 +3582,12 @@ pgstat_get_wait_ipc(WaitEventIPC w)
35793582
caseWAIT_EVENT_EXECUTE_GATHER:
35803583
event_name="ExecuteGather";
35813584
break;
3585+
caseWAIT_EVENT_LOGICAL_SYNC_DATA:
3586+
event_name="LogicalSyncData";
3587+
break;
3588+
caseWAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE:
3589+
event_name="LogicalSyncStateChange";
3590+
break;
35823591
caseWAIT_EVENT_MQ_INTERNAL:
35833592
event_name="MessageQueueInternal";
35843593
break;
@@ -3600,18 +3609,15 @@ pgstat_get_wait_ipc(WaitEventIPC w)
36003609
caseWAIT_EVENT_PROCARRAY_GROUP_UPDATE:
36013610
event_name="ProcArrayGroupUpdate";
36023611
break;
3612+
caseWAIT_EVENT_REPLICATION_SLOT_DROP:
3613+
event_name="ReplicationSlotDrop";
3614+
break;
36033615
caseWAIT_EVENT_SAFE_SNAPSHOT:
36043616
event_name="SafeSnapshot";
36053617
break;
36063618
caseWAIT_EVENT_SYNC_REP:
36073619
event_name="SyncRep";
36083620
break;
3609-
caseWAIT_EVENT_LOGICAL_SYNC_DATA:
3610-
event_name="LogicalSyncData";
3611-
break;
3612-
caseWAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE:
3613-
event_name="LogicalSyncStateChange";
3614-
break;
36153621
/* no default case, so that compiler will warn */
36163622
}
36173623

‎src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ libpqrcv_connect(const char *conninfo, bool logical, const char *appname,
181181
WL_LATCH_SET |io_flag,
182182
PQsocket(conn->streamConn),
183183
0,
184-
WAIT_EVENT_LIBPQWALRECEIVER);
184+
WAIT_EVENT_LIBPQWALRECEIVER_CONNECT);
185185

186186
/* Emergency bailout? */
187187
if (rc&WL_POSTMASTER_DEATH)
@@ -582,7 +582,7 @@ libpqrcv_PQexec(PGconn *streamConn, const char *query)
582582
WL_LATCH_SET,
583583
PQsocket(streamConn),
584584
0,
585-
WAIT_EVENT_LIBPQWALRECEIVER);
585+
WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE);
586586

587587
/* Emergency bailout? */
588588
if (rc&WL_POSTMASTER_DEATH)

‎src/backend/replication/slot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@ ReplicationSlotAcquire(const char *name, bool nowait)
391391
name,active_pid)));
392392

393393
/* Wait here until we get signaled, and then restart */
394-
ConditionVariableSleep(&slot->active_cv,PG_WAIT_LOCK);
394+
ConditionVariableSleep(&slot->active_cv,
395+
WAIT_EVENT_REPLICATION_SLOT_DROP);
395396
ConditionVariableCancelSleep();
396397
gotoretry;
397398
}

‎src/include/pgstat.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -759,15 +759,15 @@ typedef enum
759759
WAIT_EVENT_BGWRITER_HIBERNATE,
760760
WAIT_EVENT_BGWRITER_MAIN,
761761
WAIT_EVENT_CHECKPOINTER_MAIN,
762+
WAIT_EVENT_LOGICAL_LAUNCHER_MAIN,
763+
WAIT_EVENT_LOGICAL_APPLY_MAIN,
762764
WAIT_EVENT_PGSTAT_MAIN,
763765
WAIT_EVENT_RECOVERY_WAL_ALL,
764766
WAIT_EVENT_RECOVERY_WAL_STREAM,
765767
WAIT_EVENT_SYSLOGGER_MAIN,
766768
WAIT_EVENT_WAL_RECEIVER_MAIN,
767769
WAIT_EVENT_WAL_SENDER_MAIN,
768-
WAIT_EVENT_WAL_WRITER_MAIN,
769-
WAIT_EVENT_LOGICAL_LAUNCHER_MAIN,
770-
WAIT_EVENT_LOGICAL_APPLY_MAIN
770+
WAIT_EVENT_WAL_WRITER_MAIN
771771
}WaitEventActivity;
772772

773773
/* ----------
@@ -782,9 +782,10 @@ typedef enum
782782
{
783783
WAIT_EVENT_CLIENT_READ=PG_WAIT_CLIENT,
784784
WAIT_EVENT_CLIENT_WRITE,
785+
WAIT_EVENT_LIBPQWALRECEIVER_CONNECT,
786+
WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE,
785787
WAIT_EVENT_SSL_OPEN_SERVER,
786788
WAIT_EVENT_WAL_RECEIVER_WAIT_START,
787-
WAIT_EVENT_LIBPQWALRECEIVER,
788789
WAIT_EVENT_WAL_SENDER_WAIT_WAL,
789790
WAIT_EVENT_WAL_SENDER_WRITE_DATA
790791
}WaitEventClient;
@@ -802,17 +803,18 @@ typedef enum
802803
WAIT_EVENT_BGWORKER_STARTUP,
803804
WAIT_EVENT_BTREE_PAGE,
804805
WAIT_EVENT_EXECUTE_GATHER,
806+
WAIT_EVENT_LOGICAL_SYNC_DATA,
807+
WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE,
805808
WAIT_EVENT_MQ_INTERNAL,
806809
WAIT_EVENT_MQ_PUT_MESSAGE,
807810
WAIT_EVENT_MQ_RECEIVE,
808811
WAIT_EVENT_MQ_SEND,
809812
WAIT_EVENT_PARALLEL_FINISH,
810813
WAIT_EVENT_PARALLEL_BITMAP_SCAN,
811814
WAIT_EVENT_PROCARRAY_GROUP_UPDATE,
815+
WAIT_EVENT_REPLICATION_SLOT_DROP,
812816
WAIT_EVENT_SAFE_SNAPSHOT,
813-
WAIT_EVENT_SYNC_REP,
814-
WAIT_EVENT_LOGICAL_SYNC_DATA,
815-
WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE
817+
WAIT_EVENT_SYNC_REP
816818
}WaitEventIPC;
817819

818820
/* ----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp