Skip to content

Commit fce003c

Browse files
author
Amit Kapila
committed
Add a new wait state and use it when sending data in the apply worker.
d9d7fe6 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
1 parent 1b43743 commit fce003c

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

doc/src/sgml/monitoring.sgml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
17401740
<entry>Waiting for other Parallel Hash participants to finish inserting
17411741
tuples into new buckets.</entry>
17421742
</row>
1743+
<row>
1744+
<entry><literal>LogicalApplySendData</literal></entry>
1745+
<entry>Waiting for a logical replication leader apply process to send
1746+
data to a parallel apply process.</entry>
1747+
</row>
17431748
<row>
17441749
<entry><literal>LogicalParallelApplyStateChange</literal></entry>
17451750
<entry>Waiting for a logical replication parallel apply process to change

src/backend/replication/logical/applyparallelworker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,8 @@ pa_send_data(ParallelApplyWorkerInfo *winfo, Size nbytes, const void *data)
11811181
/* Wait before retrying. */
11821182
rc = WaitLatch(MyLatch,
11831183
WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
1184-
SHM_SEND_RETRY_INTERVAL_MS, WAIT_EVENT_MQ_SEND);
1184+
SHM_SEND_RETRY_INTERVAL_MS,
1185+
WAIT_EVENT_LOGICAL_APPLY_SEND_DATA);
11851186

11861187
if (rc & WL_LATCH_SET)
11871188
{

src/backend/utils/activity/wait_event.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ pgstat_get_wait_ipc(WaitEventIPC w)
391391
case WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT:
392392
event_name = "HashGrowBucketsReinsert";
393393
break;
394+
case WAIT_EVENT_LOGICAL_APPLY_SEND_DATA:
395+
event_name = "LogicalApplySendData";
396+
break;
394397
case WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE:
395398
event_name = "LogicalParallelApplyStateChange";
396399
break;

src/include/utils/wait_event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ typedef enum
106106
WAIT_EVENT_HASH_GROW_BUCKETS_ALLOCATE,
107107
WAIT_EVENT_HASH_GROW_BUCKETS_ELECT,
108108
WAIT_EVENT_HASH_GROW_BUCKETS_REINSERT,
109+
WAIT_EVENT_LOGICAL_APPLY_SEND_DATA,
109110
WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE,
110111
WAIT_EVENT_LOGICAL_SYNC_DATA,
111112
WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE,

0 commit comments

Comments
 (0)