Re: Adding a LogicalRepWorker type field

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding a LogicalRepWorker type field
Date: 2023-08-02 02:40:04
Message-ID: CAHut+PvsLw4xO=8sLqQO4a3zgJyJkyt0uVycbw_uyXDXr2m8Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 31, 2023 at 11:11 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> +1. BTW, do we need the below functions (am_tablesync_worker(),
> am_leader_apply_worker()) after this work?
> static inline bool
> am_tablesync_worker(void)
> {
> - return OidIsValid(MyLogicalRepWorker->relid);
> + return isTablesyncWorker(MyLogicalRepWorker);
> }
>
> static inline bool
> am_leader_apply_worker(void)
> {
> - return (!am_tablesync_worker() &&
> - !isParallelApplyWorker(MyLogicalRepWorker));
> + return isLeaderApplyWorker(MyLogicalRepWorker);
> }
>

The am_xxx functions are removed now in the v2-0001 patch. See [1].

The replacement set of macros (the ones with no arg) are not strictly
necessary, except I felt it would make the code unnecessarily verbose
if we insist to pass MyLogicalRepWorker everywhere from the callers in
worker.c / tablesync.c / applyparallelworker.c.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-08-02 02:50:32 Re: Simplify some logical replication worker type checking
Previous Message David G. Johnston 2023-08-02 02:36:01 Re: Documentation of psql's \df no longer matches reality