| From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
|---|---|
| To: | Hüseyin Demir <huseyin(dot)d3r(at)gmail(dot)com> |
| Cc: | Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shvetamalik(at)gmail(dot)com> |
| Subject: | Re: [PATCH] Report changes discarded for relations not in the subscription |
| Date: | 2026-12-04 06:00:12 |
| Message-ID: | CAJpy0uCTf-1L7+ec=FP1fR8pr68hdHuYob4HQXcrrwJWuoR=zA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Dec 3, 2026 at 10:43 AM Hüseyin Demir <huseyin(dot)d3r(at)gmail(dot)com> wrote:
>
> Thanks for the review. All three points are addressed in the attached v7.
>
> > 1.
> > #define SUBREL_STATE_INIT_LAST_UNAPPLIED '?'
>
> Agreed, the similarity to SUBREL_STATE_INIT is misleading. Renamed to
> SUBREL_STATE_LAST_UNAPPLIED_NONE.
>
> > 2.
> > ... the placement of this new field has split `state` and `statelsn`
> > ... Suggests putting your new field last.
>
> Done. last_unapplied_state is now the last field of
> LogicalRepRelMapEntry, so state and statelsn are together again under
> their "Sync state." comment.
>
> > 3.
> > ... other wait_for_log(...) are not wrapped in ok(), so the
> > ones in this patch didn't need to be either.
>
> Right. wait_for_log() dies on timeout rather than returning false, so
> the ok() did not add anything, and no other test wraps it. v7 calls
> wait_for_log() directly in both 024_add_drop_pub.pl and 015_stream.pl,
> still with the combined LOG and DETAIL regex. There are no behaviour
> changes. 024_add_drop_pub and 015_stream pass.
>
Thanks for taking care of my earlier comments. A few trivial things:
1)
+ errhint("If this relation should be replicated, use ALTER
SUBSCRIPTION ... REFRESH PUBLICATION."));
Should this be written as below, so that translators don't translate
the SQL command text?
errhint("If this relation should be replicated, use %s.",
"ALTER SUBSCRIPTION ... REFRESH PUBLICATION")
2)
SUBREL_STATE_LAST_UNAPPLIED_NONE is defined under
EXPOSE_TO_CLIENT_CODE in pg_subscription_rel.h, so genbki.pl copies it
into pg_subscription_rel_d.h, which is meant for values frontend code
may need. It is not a catalog state and is only used by the apply
worker. How about moving it to logicalrelation.h, next to
last_unapplied_state?
3)
If a table is renamed on the publisher, and a table with the new name
already exists on the subscriber but is not part of the subscription,
the subsequent discarded changes are not reported, because
last_unapplied_state is carried over from the old entry. This is a
minor case, so it's up to you whether to handle it. A possible fix is
to carry over last_unapplied_state only when nspname and relname in
the new RELATION message match the old entry. But again, I would like
to see what you and others think before we fix this.
thanks
Shveta
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2026-12-04 06:00:54 | Re: Better shared data structure management and resizable shared data structures |
| Previous Message | Atsushi Torikoshi | 2026-12-04 05:21:24 | Re: Why is the LSN reported for pg_logical_emit_message() different from other decoded operations? |