Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-14 Thread Amit Kapila
On Mon, Sep 13, 2021 at 10:42 PM Tom Lane wrote: > > Alvaro Herrera writes: > > Am I the only that that thinks this code is doing far too much in a > > PG_CATCH block? > > You mean the one in ReorderBufferProcessTXN? Yeah, that is mighty > ugly. It might be all right given that it almost

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-13 Thread Tom Lane
Alvaro Herrera writes: > Am I the only that that thinks this code is doing far too much in a > PG_CATCH block? You mean the one in ReorderBufferProcessTXN? Yeah, that is mighty ugly. It might be all right given that it almost immediately does AbortCurrentTransaction, since that should

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-13 Thread Alvaro Herrera
On 2021-Sep-06, Amit Kapila wrote: > 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

Re: [UNVERIFIED SENDER] Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-09 Thread Amit Kapila
On Tue, Sep 7, 2021 at 2:02 PM Drouvot, Bertrand wrote: > > On 9/7/21 9:11 AM, Drouvot, Bertrand wrote: > > > > Please find enclosed patch v2 (for the master branch) implementing the > modified approach of option 2) proposed by Amit. > The patch looks good to me. I have made a minor modification

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-07 Thread Amit Kapila
On Tue, Sep 7, 2021 at 11:33 AM Drouvot, Bertrand wrote: > > Hi, > > On 9/7/21 7:58 AM, Dilip Kumar wrote: > > > On Tue, Sep 7, 2021 at 11:10 AM Amit Kapila wrote: > >> >> Isn't it better if we use option 2) at all places as then we won't >> >> need any special check inside

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Dilip Kumar
On Tue, Sep 7, 2021 at 11:10 AM Amit Kapila wrote: >> Isn't it better if we use option 2) at all places as then we won't > >> need any special check inside ReorderBufferChangeMemoryUpdate()? > > > > > > If we want to do this then be careful about > REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID change.

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Amit Kapila
On Tue, Sep 7, 2021 at 11:08 AM Dilip Kumar wrote: > > On Tue, Sep 7, 2021 at 8:38 AM Amit Kapila wrote: >> >> On Mon, Sep 6, 2021 at 9:14 PM Dilip Kumar wrote: >> > >> > On Mon, Sep 6, 2021 at 8:54 PM Drouvot, Bertrand >> > wrote: >> >> >> >> Thanks for your feedback! >> >> >> >> That seems

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Dilip Kumar
On Tue, Sep 7, 2021 at 8:38 AM Amit Kapila wrote: > On Mon, Sep 6, 2021 at 9:14 PM Dilip Kumar wrote: > > > > On Mon, Sep 6, 2021 at 8:54 PM Drouvot, Bertrand > wrote: > >> > >> Thanks for your feedback! > >> > >> That seems indeed more logical, so I see 3 options to do so: > >> > >> 1) Add a

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Amit Kapila
On Mon, Sep 6, 2021 at 9:14 PM Dilip Kumar wrote: > > On Mon, Sep 6, 2021 at 8:54 PM Drouvot, Bertrand wrote: >> >> 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 >>

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Dilip Kumar
On Mon, Sep 6, 2021 at 8:54 PM Drouvot, Bertrand wrote: > 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

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Dilip Kumar
On Mon, Sep 6, 2021 at 4:04 PM Amit Kapila wrote: > On Fri, Aug 13, 2021 at 3:15 PM Drouvot, Bertrand > wrote: > > > > > > Please find attached a patch proposal to avoid the failed assertion (by > ensuring that ReorderBufferChangeMemoryUpdate() being triggered with > "addition" set to false in

Re: [BUG] Failed Assertion in ReorderBufferChangeMemoryUpdate()

2021-09-06 Thread Amit Kapila
On Fri, Aug 13, 2021 at 3:15 PM Drouvot, Bertrand 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 >