refactor some protocol message sending in walsender and basebackup

Lists: pgsql-hackers
From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: refactor some protocol message sending in walsender and basebackup
Date: 2022-06-23 14:36:36
Message-ID: 7e4fdbdc-699c-4cd0-115d-fb78a957fc22@enterprisedb.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

Some places in walsender.c and basebackup_copy.c open-code the sending
of RowDescription and DataRow protocol messages. But there are already
more compact and robust solutions available for this, using
DestRemoteSimple and associated machinery, already in use in walsender.c.

The attached patches 0001 and 0002 are tiny bug fixes I found during this.

Patches 0003 and 0004 are the main refactorings. They should probably
be combined into one patch eventually, but this way the treatment of
RowDescription and DataRow is presented separately.

Attachment Content-Type Size
0001-Fix-attlen-in-RowDescription-of-BASE_BACKUP-response.patch text/plain 976 bytes
0002-Change-timeline-field-of-IDENTIFY_SYSTEM-to-int8.patch text/plain 1.6 KB
0003-Refactor-sending-of-RowDescription-messages-in-repli.patch text/plain 6.7 KB
0004-Refactor-sending-of-DataRow-messages-in-replication-.patch text/plain 5.2 KB

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refactor some protocol message sending in walsender and basebackup
Date: 2022-07-01 21:36:46
Message-ID: 20220701213646.GA582729@nathanxps13
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jun 23, 2022 at 04:36:36PM +0200, Peter Eisentraut wrote:
> Some places in walsender.c and basebackup_copy.c open-code the sending of
> RowDescription and DataRow protocol messages. But there are already more
> compact and robust solutions available for this, using DestRemoteSimple and
> associated machinery, already in use in walsender.c.
>
> The attached patches 0001 and 0002 are tiny bug fixes I found during this.
>
> Patches 0003 and 0004 are the main refactorings. They should probably be
> combined into one patch eventually, but this way the treatment of
> RowDescription and DataRow is presented separately.

All 4 patches look reasonable to me.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com


From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: refactor some protocol message sending in walsender and basebackup
Date: 2022-07-06 06:51:37
Message-ID: 4b856bab-c37b-559e-1ab6-68f189146013@enterprisedb.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-hackers

On 01.07.22 23:36, Nathan Bossart wrote:
> On Thu, Jun 23, 2022 at 04:36:36PM +0200, Peter Eisentraut wrote:
>> Some places in walsender.c and basebackup_copy.c open-code the sending of
>> RowDescription and DataRow protocol messages. But there are already more
>> compact and robust solutions available for this, using DestRemoteSimple and
>> associated machinery, already in use in walsender.c.
>>
>> The attached patches 0001 and 0002 are tiny bug fixes I found during this.
>>
>> Patches 0003 and 0004 are the main refactorings. They should probably be
>> combined into one patch eventually, but this way the treatment of
>> RowDescription and DataRow is presented separately.
>
> All 4 patches look reasonable to me.

All committed now, thanks.

(I cleaned up the 0004 patch a bit more; there was some junk left in the
posted patch.)