Re: pgstat include expansion

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Nisha Moond <nisha.moond412@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, Alvaro Herrera <alvherre@kurilemu.de>, Chao Li <li.evan.chao@gmail.com>, pgsql-hackers@postgresql.org, Michael Paquier <michael@paquier.xyz>
Date: 2026-02-19T04:46:45Z
Lists: pgsql-hackers
On Wed, Feb 18, 2026 at 10:09 AM Nisha Moond <nisha.moond412@gmail.com> wrote:
>
> On Tue, Feb 17, 2026 at 4:44 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > As the worker type is not directly available in all places, the other
> > possibility is to expose a function like GetLogicalWorkerType from
> > worker_internal.h and use it directly in
> > pgstat_report_subscription_error() instead of passing it via
> > parameter. We can get the worker_type via MyLogicalRepWorker->type
> > which should be accessible as it will be invoked by one of the logical
> > replication workers.
> >
> +1
> This seems like a cleaner approach than adding multiple worker
> specific checks and functions.
> Here is a patch that implements this idea.
>

LGTM. I'll push this tomorrow unless there are comments/objections on
this patch.

-- 
With Regards,
Amit Kapila.



Commits

  1. Don't include wait_event.h in pgstat.h

  2. Don't include proc.h in shm_mq.h

  3. Don't include latch.h in libpq/libpq.h

  4. Reduce includes in pgstat.h

  5. Avoid including utils/timestamp.h in conflict.h.

  6. Avoid including worker_internal.h in pgstat.h.

  7. Add seq_sync_error_count to subscription statistics.

  8. Don't include execnodes.h in replication/conflict.h

  9. Collect statistics about conflicts in logical replication.