Re: Flushing large data immediately in pqcomm

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: Flushing large data immediately in pqcomm
Дата
Msg-id CAEudQAoNvfugAH6dVfRveduqeh_URU27e7oRF=yVP6K+om1iCw@mail.gmail.com
обсуждение исходный текст
Ответ на Flushing large data immediately in pqcomm  (Melih Mutlu <m.melihmutlu@gmail.com>)
Список pgsql-hackers
Hi,

On Fri, 5 Apr 2024 at 03:28, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com> wrote:
>Right. It was a mistake, forgot to remove that. Fixed it in v5.

If you don't mind, I have some suggestions for patch v5.

1.  Shouldn't PqSendBufferSize be of type size_t?
There are several comparisons with other size_t variables.
static size_t PqSendBufferSize; /* Size send buffer */

I think this would prevent possible overflows.

2. If PqSendBufferSize is changed to size_t, in the function
socket_putmessage_noblock, the variable which name is *required*, should
be changed to size_t as well.

static void
socket_putmessage_noblock(char msgtype, const char *s, size_t len)
{
int res PG_USED_FOR_ASSERTS_ONLY;
size_t required;

3. In the internal_putbytes function, the *amout* variable could
have the scope safely reduced.

else
{
size_t amount;

amount = PqSendBufferSize - PqSendPointer;

4. In the function internal_flush_buffer, the variables named
*bufptr* and *bufend* could be const char * type, like:

static int
internal_flush_buffer(const char *s, size_t *start, size_t *end)
{
static int last_reported_send_errno = 0;

const char *bufptr = s + *start;
const char *bufend = s + *end;

best regards,
Ranier Vilela

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

Предыдущее
От: Corey Huinker
Дата:
Сообщение: Re: Statistics Import and Export
Следующее
От: Melanie Plageman
Дата:
Сообщение: Re: BitmapHeapScan streaming read user and prelim refactoring