pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael <xu.xw2008@163.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re:Re: BUG #18486: Is there something wrong with the calculation in ReorderBufferChangeSize()?
Date: Thu, 6 Jun 2024 18:05:54 +0800 (CST)
Message-ID: <7eb97a5b.a6b4.18fed031b9c.Coremail.xu.xw2008@163.com> (raw)
In-Reply-To: <CAA4eK1J2pO5W0qpoA3r97ijb_K00NoFS0nkKxOjgXuDu=c-4zQ@mail.gmail.com>
References: <18486-22cd3a6dc05a2454@postgresql.org>
	<CAA4eK1J2pO5W0qpoA3r97ijb_K00NoFS0nkKxOjgXuDu=c-4zQ@mail.gmail.com>

At 2024-06-04 13:28:52, "Amit Kapila" <amit.kapila16@gmail.com> wrote:

>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().
>




Thanks for your reply.




I see in the code that the function ReorderBufferChangeSize() is used to calculate the space in memory, while ReorderBufferSerializeChange()/ReorderBufferRestoreChange() calculates the space on disk. 

Am I right in understanding this?




With Regards,
Xingwang Xu







view thread (4+ messages)  latest in thread

Message-ID: <7eb97a5b.a6b4.18fed031b9c.Coremail.xu.xw2008@163.com>
Permalink:  ../7eb97a5b.a6b4.18fed031b9c.Coremail.xu.xw2008@163.com/
Also on:    postgresql.org/message-id/7eb97a5b.a6b4.18fed031b9c.Coremail.xu.xw2008@163.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: xu.xw2008@163.com, amit.kapila16@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re:Re: BUG #18486: Is there something wrong with the calculation in ReorderBufferChangeSize()?
  In-Reply-To: <7eb97a5b.a6b4.18fed031b9c.Coremail.xu.xw2008@163.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox