Re: Fix stats reporting delays in logical parallel apply worker - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Fix stats reporting delays in logical parallel apply worker
Date
Msg-id CAA4eK1JF-zny8pGP4Mafk8=mNBCV8A0a1-6HvVd1Q2ZVJW-NJw@mail.gmail.com
Whole thread
In response to Fix stats reporting delays in logical parallel apply worker  ("Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>)
Responses Re: Fix stats reporting delays in logical parallel apply worker
List pgsql-hackers
On Fri, Apr 17, 2026 at 8:31 AM Zhijie Hou (Fujitsu)
<houzj.fnst@fujitsu.com> wrote:
>
> 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.
>

LGTM. We should backpatch this change.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: [PATCH] Fix TOCTOU race in ReplicationSlotsComputeRequiredLSN()
Next
From: shveta malik
Date:
Subject: Re: Parallel Apply