pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Drouvot, Bertrand <bdrouvot@amazon.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()
Date: Mon, 6 Sep 2021 17:24:23 +0200
Message-ID: <73dcd904-cfee-21f2-d363-317cd517cb00@amazon.com> (raw)
In-Reply-To: <CAFiTN-uoTz0bUtOoZxJcB7kPt9xMrKsDATTXoJfktJtPOfC_bw@mail.gmail.com>
References: <92b0ee65-b8bd-e42d-c082-4f3f4bf12d34@amazon.com>
	<CAA4eK1LfzPdTO73vW2qUkJeB1k1iL04rmqVJseBbF5qRAonmiw@mail.gmail.com>
	<CAFiTN-uoTz0bUtOoZxJcB7kPt9xMrKsDATTXoJfktJtPOfC_bw@mail.gmail.com>

Hi,

On 9/6/21 1:54 PM, Dilip Kumar wrote:
>
> *CAUTION*: This email originated from outside of the organization. Do 
> not click links or open attachments unless you can confirm the sender 
> and know the content is safe.
>
>
> On Mon, Sep 6, 2021 at 4:04 PM Amit Kapila <amit.kapila16@gmail.com 
> <mailto:amit.kapila16@gmail.com>> wrote:
>
>     On Fri, Aug 13, 2021 at 3:15 PM Drouvot, Bertrand
>     <bdrouvot@amazon.com <mailto:bdrouvot@amazon.com>> wrote:
>     >
>     >
>     > Please find attached a patch proposal to avoid the failed
>     assertion (by ensuring that ReorderBufferChangeMemoryUpdate()
>     being triggered with "addition" set to false in
>     ReorderBufferToastReplace() is done after the elog(ERROR,)).
>     >
>
>     The error can occur at multiple places (like via palloc or various
>     other places) between the first time we subtract the change_size and
>     add it back after the change is re-computed. I think the correct fix
>     would be that in the beginning we just compute the change_size by
>     ReorderBufferChangeSize and then after re-computing the change, we
>     just subtract the old change_size and add the new change_size. What do
>     you think?
>
>
> Yeah, that seems more logical to me.

Thanks for your feedback!

That seems indeed more logical, so I see 3 options to do so:

  1) Add a new API say ReorderBufferChangeMemorySubstractSize() (with a 
Size as one parameter) and make use of it in ReorderBufferToastReplace()

  2) Add a new "Size" parameter to ReorderBufferChangeMemoryUpdate(), so 
that if this parameter is > 0 then it would be used instead of "sz = 
ReorderBufferChangeSize(change)"

  3) Do the substraction directly into ReorderBufferToastReplace() 
without any API

I'm inclined to go for option 2), what do you think?

Thanks

Bertrand

view thread (19+ messages)  latest in thread

Message-ID: <73dcd904-cfee-21f2-d363-317cd517cb00@amazon.com>
Permalink:  ../73dcd904-cfee-21f2-d363-317cd517cb00@amazon.com/
Also on:    postgresql.org/message-id/73dcd904-cfee-21f2-d363-317cd517cb00@amazon.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-hackers@postgresql.org
  Cc: bdrouvot@amazon.com, dilipbalaut@gmail.com, amit.kapila16@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()
  In-Reply-To: <73dcd904-cfee-21f2-d363-317cd517cb00@amazon.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