Re: Add null termination to string received in parallel apply worker

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Add null termination to string received in parallel apply worker
Дата
Msg-id 202310111514.soqok7g65vit@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Add null termination to string received in parallel apply worker  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: Add null termination to string received in parallel apply worker  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2023-Oct-11, Amit Kapila wrote:

> Yeah, it may not be a good idea to modify the buffer pointing to
> shared memory without any lock as we haven't reserved that part of
> memory. So, we can't follow the trick used in exec_bind_message() to
> maintain the convention that StringInfos have a trailing null. David,
> do you see any better way to fix this case?

I was thinking about this when skimming the other StringInfo thread a
couple of days ago.  I wondered if it wouldn't be more convenient to
change the convention that all StringInfos are null-terminated: what is
really the reason to have them all be like that?  We do keep track of
the exact length of the data in it, so strictly speaking we don't need
the assumption.  Maybe there are some routines that are fragile and end
up reading more data thn 'len' if the null terminator is missing; we
could fix those instead.  Right now, it seems we're doing some
pstrdup'ing and unconstification just to be able to install a \0 in the
right place.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"Use it up, wear it out, make it do, or do without"



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tommy Pavlicek
Дата:
Сообщение: Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges
Следующее
От: "Imseih (AWS), Sami"
Дата:
Сообщение: Re: Logging parallel worker draught