Re: crash while decoding INSERT ON CONFLICT

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Euler Taveira <euler(at)timbira(dot)com(dot)br>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: crash while decoding INSERT ON CONFLICT
Date: 2018-05-22 01:37:00
Message-ID: CAH2-Wz=5NkGGjaFwuMePUNpx1OTq+jnB_AWwU9Af-XC1+cAijQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, May 21, 2018 at 1:31 PM, Euler Taveira <euler(at)timbira(dot)com(dot)br> wrote:
> (gdb) bt full

Have you managed to see the crash more than once in your environment?
I wonder if the problem is somehow related to spilling to a reorder
buffer temp/spool file.

I must admit that I don't really understand the interactions between
this code, within ReorderBufferCommit():

case REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT:

/*
* Speculative insertions are dealt with by delaying the
* processing of the insert until the confirmation record
* arrives. For that we simply unlink the record from the
* chain, so it does not get freed/reused while restoring
* spooled data from disk.
*
* ...
*/

...

/* and memorize the pending insertion */
dlist_delete(&change->node);
specinsert = change;
break;

...with the code for dealing with in-memory change records when
loading from disk, within ReorderBufferIterTXNNext():

/* try to load changes from disk */
if (entry->txn->nentries != entry->txn->nentries_mem)
{
/*
* Ugly: restoring changes will reuse *Change records, thus delete the
* current one from the per-tx list and only free in the next call.
*/
dlist_delete(&change->node);
dlist_push_tail(&state->old_change, &change->node);
...

Perhaps I've missed something obvious.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira 2018-05-22 03:49:10 Re: crash while decoding INSERT ON CONFLICT
Previous Message Euler Taveira 2018-05-21 20:31:16 Re: crash while decoding INSERT ON CONFLICT