Re: BUG #18486: Is there something wrong with the calculation in ReorderBufferChangeSize()?

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: BUG #18486: Is there something wrong with the calculation in ReorderBufferChangeSize()?
Дата
Msg-id CAA4eK1J2pO5W0qpoA3r97ijb_K00NoFS0nkKxOjgXuDu=c-4zQ@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18486: Is there something wrong with the calculation in ReorderBufferChangeSize()?  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re:Re: BUG #18486: Is there something wrong with the calculation in ReorderBufferChangeSize()?
Список pgsql-bugs
On Thu, May 30, 2024 at 2:30 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference:      18486
> Logged by:          Xingwang Xu
> Email address:      xu.xw2008@163.com
> PostgreSQL version: 17beta1
> Operating system:   CentOS7.9
> Description:
>
> In the code related to logical replication, there is a function
> ReorderBufferChangeSize(), which is used to calculate the size of a change
> in memory.
>
> When looking at the ReorderBufferChangeSize() function, I saw the following
> code:
>
>     case REORDER_BUFFER_CHANGE_MESSAGE:
>         {
>             Size        prefix_size = strlen(change->data.msg.prefix) + 1;
>
>             sz += prefix_size + change->data.msg.message_size +
>                 sizeof(Size) + sizeof(Size);
>
>             break;
>         }
>
> When calculating the change size of the message type, there are two
> “sizeof(Size)” in the code. It is not clear why these two “sizeof(Size)” are
> added and whether these two “sizeof(Size)” are redundant.
>

These two sizeof(Size) are added as while serializing or restoring
message change, we explicitly serialize/restore the size of the prefix
and the actual message. See
ReorderBufferSerializeChange()/ReorderBufferRestoreChange().

--
With Regards,
Amit Kapila.



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #17947: Combination of replslots pgstat issues causes error/assertion failure
Следующее
От: Mor Lehr
Дата:
Сообщение: Re: Missing semicolumn in anonymous plpgsql block does not raise syntax error