From e3ee2c6a7c8cb0439fb894c9019d29e2bdcc408b Mon Sep 17 00:00:00 2001 From: Hou Zhijie Date: Mon, 6 Feb 2023 17:34:38 +0800 Subject: [PATCH] Use appropriate wait event when sending data Currently, we reuse WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE as the wait event while sending data to the parallel apply worker via memory queue, this seems not appropriate as user might not be able to distinguish what they are waiting for (sending data or waiting for the state chagne). To improve this, change the wait event to WAIT_EVENT_MQ_SEND which has been used in blocking mode while sending data via memory queue. Users should be able to distinguish the wait event based on this as it will be displayed in logical replication worker row. --- src/backend/replication/logical/applyparallelworker.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/replication/logical/applyparallelworker.c b/src/backend/replication/logical/applyparallelworker.c index e670ec6..da437e0 100644 --- a/src/backend/replication/logical/applyparallelworker.c +++ b/src/backend/replication/logical/applyparallelworker.c @@ -1181,8 +1181,7 @@ 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_LOGICAL_PARALLEL_APPLY_STATE_CHANGE); + SHM_SEND_RETRY_INTERVAL_MS, WAIT_EVENT_MQ_SEND); if (rc & WL_LATCH_SET) { -- 2.7.2.windows.1