pgsql: Make use of initReadOnlyStringInfo() in more places - Mailing list pgsql-committers

From David Rowley
Subject pgsql: Make use of initReadOnlyStringInfo() in more places
Date
Msg-id E1r07w9-004F1C-6q@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make use of initReadOnlyStringInfo() in more places

f0efa5aec introduced the concept of "read-only" StringInfos which makes
use of an existing, possibly not NUL terminated, buffer.

Here we adjust two places that make use of StringInfos to receive data
to avoid using appendBinaryStringInfo() in cases where a NUL termination
character is not required.  This saves a possible palloc() and saves
having to needlessly memcpy() from one buffer to another.

Here we adjust two places which were using appendBinaryStringInfo().
Neither of these cases seem particularly performance-critical.  In the
case of XLogWalRcvProcessMsg(), the appendBinaryStringInfo() was only
appending 24 bytes.  The change made here does mean that we can get rid
of the incoming_message global variable and make that local instead.

The apply_spooled_messages() case applies in logical decoding when
applying (possibly large) changes which have been serialized to a file.

Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/CAApHDvoxYUDHwqPf-ShvchsERf1RzmkGoLwg63JNvHCkDCuyKQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ac7d6f5f831e4dd83d891b95560d514b2d722d98

Modified Files
--------------
src/backend/replication/logical/worker.c |  8 +++-----
src/backend/replication/walreceiver.c    | 18 ++++++++++--------
2 files changed, 13 insertions(+), 13 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Stamp 11.22.
Next
From: Amit Kapila
Date:
Subject: Re: pgsql: Migrate logical slots to the new node during an upgrade.