Fix stats reporting delays in logical parallel apply worker

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix stats reporting delays in logical parallel apply worker
Date: 2026-04-17 03:01:08
Message-ID: TYRPR01MB1419579F217CC4332B615589594202@TYRPR01MB14195.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When implementing another feature, I noticed that parallel apply workers
currently do not report statistics while idle in their main loop. This can cause
stats from the last processed transaction to be arbitrarily delayed, especially
when there are long gaps between streamed transactions.

The issue is demonstrated in 0002, where a TAP test fails when attempting to
collect stats from a parallel apply worker that has no subsequent transaction to
trigger a stats report.

0001 fixes this issue by forcing a stats report when the worker is idle in the
main loop, matching the behavior already present in LogicalRepApplyLoop() for
regular logical apply workers.

Best Regards,
Hou zj

Attachment Content-Type Size
v1-0002-Test-the-stats-report-in-parallel-apply-worker.patch application/octet-stream 1.3 KB
v1-0001-Fix-stats-reporting-delays-in-parallel-apply-work.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2026-04-17 03:20:08 Re: DELETE/UPDATE FOR PORTION OF with rule system is not working
Previous Message Hu Xunqi 2026-04-17 02:49:26 Re: Reject invalid databases in pg_get_database_ddl()