Re: crash while decoding INSERT ON CONFLICT - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: crash while decoding INSERT ON CONFLICT
Date
Msg-id CAH2-Wz=5NkGGjaFwuMePUNpx1OTq+jnB_AWwU9Af-XC1+cAijQ@mail.gmail.com
Whole thread Raw
In response to Re: crash while decoding INSERT ON CONFLICT  (Euler Taveira <euler@timbira.com.br>)
Responses Re: crash while decoding INSERT ON CONFLICT
List pgsql-bugs
On Mon, May 21, 2018 at 1:31 PM, Euler Taveira <euler@timbira.com.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


pgsql-bugs by date:

Previous
From: Euler Taveira
Date:
Subject: Re: crash while decoding INSERT ON CONFLICT
Next
From: Euler Taveira
Date:
Subject: Re: crash while decoding INSERT ON CONFLICT