Re: BUG #14208: Inconsistent code modification - 3 - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #14208: Inconsistent code modification - 3
Date
Msg-id 20160630165542.m2rvs42r3eu3cmlk@alap3.anarazel.de
Whole thread Raw
In response to Re: BUG #14208: Inconsistent code modification - 3  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #14208: Inconsistent code modification - 3  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 2016-06-30 12:51:51 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2016-06-30 12:40:19 -0400, Tom Lane wrote:
> >> Whether or not the toplevel transaction is empty, by the time we get here
> >> it would have nentries == nentries_mem, no?
>
> > Not, if the top-level transaction spilled to disk.
>
> But doesn't the code stanza just above this loop pull that spillage
> back in?

Do you mean the following?
    /* add toplevel transaction if it contains changes */
    if (txn->nentries > 0)
    {
        ReorderBufferChange *cur_change;

        if (txn->nentries != txn->nentries_mem)
            ReorderBufferRestoreChanges(rb, txn, &state->entries[off].fd,
                                        &state->entries[off].segno);

If so, sure, it pulls changes back in, but only the first
static const Size max_changes_in_memory = 4096;
ones. We should never reconstruct a whole large transaction in memory...

- Andres

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #14208: Inconsistent code modification - 3
Next
From: Tom Lane
Date:
Subject: Re: BUG #14208: Inconsistent code modification - 3