pgsql: Make use of initReadOnlyStringInfo() in more places

Поиск
Список
Период
Сортировка
От David Rowley
Тема pgsql: Make use of initReadOnlyStringInfo() in more places
Дата
Msg-id E1r07w9-004F1C-6q@gemulon.postgresql.org
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Stamp 11.22.
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: pgsql: Migrate logical slots to the new node during an upgrade.