RE: Simplify some codes in pgoutput

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: RE: Simplify some codes in pgoutput
Date: 2023-03-23 01:26:58
Message-ID: OS3PR01MB5718797227A375EAF8570A1094879@OS3PR01MB5718.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Monday, March 20, 2023 5:20 PMhouzj(dot)fnst(at)fujitsu(dot)com wrote:
>
> On Thursday, March 16, 2023 12:30 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
>
> >
> > On Wed, Mar 15, 2023 at 2:00 PM houzj(dot)fnst(at)fujitsu(dot)com
> > <houzj(dot)fnst(at)fujitsu(dot)com> wrote:
> > >
> > > I noticed that there are some duplicated codes in pgoutput_change()
> > function
> > > which can be simplified, and here is an attempt to do that.
> > >
> >
> > For REORDER_BUFFER_CHANGE_DELETE, when the old tuple is missing, after
> > this patch, we will still send BEGIN and do OutputPluginWrite, etc.
> > Also, it will try to perform row_filter when none of old_slot or
> > new_slot is set. I don't know for which particular case we have s
> > handling missing old tuples for deletes but that might require changes
> > in your proposed patch.
>
> I researched this a bit. I think the old tuple will be null only if the modified table
> doesn't have PK or RI when the DELETE happens (referred to the heap_delete()),
> but in that case the DELETE won't be allowed to be replicated(e.g. the DELETE
> will either error out or be filtered by table level filter in pgoutput_change).
>
> I also checked this for system table and in that case it is null but reorderbuffer
> doesn't forward it. For user_catalog_table, similarily, the DELETE should be
> filtered by table filter in pgoutput_change as well.
>
> So, I think we can remove this check and log.
> And here is the new version patch which removes that for now.

After rethinking about this, it seems better leave this check for now. Although
it may be unnecessary, but we can remove that later as a separate patch when we
are sure about this. So, here is a patch that add this check back.

Best Regards,
Hou zj

Attachment Content-Type Size
v3-0001-simplify-the-code-in-pgoutput_change.patch application/octet-stream 8.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anatoly Zaretsky 2023-03-23 01:45:17 [PATCH] Remove unnecessary unbind in LDAP search+bind mode
Previous Message Andres Freund 2023-03-23 00:38:38 Re: HOT chain validation in verify_heapam()