[HACKERS] some review comments on logical rep code - Mailing list pgsql-hackers

From Fujii Masao
Subject [HACKERS] some review comments on logical rep code
Date
Msg-id CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] some review comments on logical rep code  (Noah Misch <noah@leadboat.com>)
Re: [HACKERS] some review comments on logical rep code  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
Hi,

Though I've read only a part of the logical rep code yet, I'd like to
share some (relatively minor) review comments that I got so far.

In ApplyWorkerMain(), DatumGetInt32() should be used to get integer
value from the argument, instead of DatumGetObjectId().

No one resets on_commit_launcher_wakeup flag to false.

ApplyLauncherWakeup() should be static function.

Seems not only CREATE SUBSCRIPTION but also ALTER SUBSCRIPTION's
subcommands (e.g., ENABLED one) should wake the launcher up on commit.

Why is IsBackendPid() check necessary in ApplyLauncherWakeup()?

Normal statements that the walsender for logical rep runs are logged
by log_replication_commands. So if log_statement is also set,
those commands are logged twice.

LogicalRepCtx->launcher_pid isn't reset to 0 when the launcher emits
an error. The callback function to reset it needs to be registered
via on_shmem_exit().

Typo: "an subscriber" should be "a subscriber" in some places.
   /* Get conninfo */   datum = SysCacheGetAttr(SUBSCRIPTIONOID,       tup,       Anum_pg_subscription_subconninfo,
 &isnull);   Assert(!isnull);
 

This assertion makes me think that pg_subscription.subconnifo should
have NOT NULL constraint. Also subslotname and subpublications
should have NOT NULL constraint because of the same reason.
   SpinLockAcquire(&MyLogicalRepWorker->relmutex);   MyLogicalRepWorker->relstate =
GetSubscriptionRelState(MyLogicalRepWorker->subid,          MyLogicalRepWorker->relid,
&MyLogicalRepWorker->relstate_lsn,          false);   SpinLockRelease(&MyLogicalRepWorker->relmutex);
 

Non-"short-term" function like GetSubscriptionRelState() should not
be called while spinlock is being held.

Regards,

-- 
Fujii Masao



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] pg_upgrade vs extension upgrades
Next
From: Magnus Hagander
Date:
Subject: Re: [HACKERS] pg_upgrade vs extension upgrades