diff options
author | Amit Kapila <akapila@postgresql.org> | 2023-02-16 07:46:31 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2023-02-16 07:46:31 +0530 |
commit | fce003cfde219b7016140f83f67ebcfdf75aa0dc (patch) | |
tree | 620bb51220cf7add670e293c7930cff73c744606 | |
parent | 1b43743f1174a5b98f77c8090a89d829c2874441 (diff) | |
download | postgresql-fce003cfde219b7016140f83f67ebcfdf75aa0dc.tar.gz postgresql-fce003cfde219b7016140f83f67ebcfdf75aa0dc.zip |
Add a new wait state and use it when sending data in the apply worker.
d9d7fe68d3 made use of an existing wait event when sending data from the
apply worker, but we should have invented a new wait event since this is a
new place to wait.
This patch corrects the mistake by using a new wait event
"LogicalApplySendData".
Author: Hou Zhijie
Reviewed-by: Peter Smith
Discussion: https://postgr.es/m/CA+TgmobWzbr9H3yN3dLVckviEZKemPwd+XyCFKEgyZQZhgP66Q@mail.gmail.com
-rw-r--r-- | doc/src/sgml/monitoring.sgml | 5 | ||||
-rw-r--r-- | src/backend/replication/logical/applyparallelworker.c | 3 | ||||
-rw-r--r-- | src/backend/utils/activity/wait_event.c | 3 | ||||
-rw-r--r-- | src/include/utils/wait_event.h | 1 |
4 files changed, 11 insertions, 1 deletions
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index dca50707ad4..b0b997f092f 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1741,6 +1741,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser tuples into new buckets.</entry> </row> <row> + <entry><literal>LogicalApplySendData</literal></entry> + <entry>Waiting for a logical replication leader apply process to send + data to a parallel apply process.</entry> + </row> + <row> <entry><literal>LogicalParallelApplyStateChange</literal></entry> <entry>Waiting for a logical replication parallel apply process to change state.</entry> diff --git a/src/backend/replication/logical/applyparallelworker.c b/src/backend/replication/logical/applyparallelworker.c index da437e0bc34..45186837795 100644 --- a/src/backend/replication/logical/applyparallelworker.c +++ b/src/backend/replication/logical/applyparallelworker.c @@ -1181,7 +1181,8 @@ pa_send_data(ParallelApplyWorkerInfo *winfo, Size nbytes, const void *data) /* Wait before retrying. */ rc = WaitLatch(MyLatch, WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH, - SHM_SEND_RETRY_INTERVAL_MS, WAIT_EVENT_MQ_SEND); + SHM_SEND_RETRY_INTERVAL_MS, + WAIT_EVENT_LOGICAL_APPLY_SEND_DATA); if (rc & WL_LATCH_SET) { diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c index 6e4599278c3..cb99cc63391 100644 --- a/src/backend/utils/activity/wait_event.c +++ b/src/backend/utils/activity/wait_event.c @@ -391,6 +391,9 @@ pgstat_get_wait_ipc(WaitEventIPC w) case WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT: event_name = "HashGrowBucketsReinsert"; break; + case WAIT_EVENT_LOGICAL_APPLY_SEND_DATA: + event_name = "LogicalApplySendData"; + break; case WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE: event_name = "LogicalParallelApplyStateChange"; break; diff --git a/src/include/utils/wait_event.h b/src/include/utils/wait_event.h index 6cacd6edaf0..9ab23e1c4ab 100644 --- a/src/include/utils/wait_event.h +++ b/src/include/utils/wait_event.h @@ -106,6 +106,7 @@ typedef enum WAIT_EVENT_HASH_GROW_BUCKETS_ALLOCATE, WAIT_EVENT_HASH_GROW_BUCKETS_ELECT, WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT, + WAIT_EVENT_LOGICAL_APPLY_SEND_DATA, WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE, WAIT_EVENT_LOGICAL_SYNC_DATA, WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE, |