Table AM callback table_complete_speculative()'s succeeded argument is reversed

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Table AM callback table_complete_speculative()'s succeeded argument is reversed
Date: 2019-05-14 11:29:01
Message-ID: 97673451-339f-b21e-a781-998d06b1067c@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The 'succeeded' argument seems backwards here:

> static void
> heapam_tuple_complete_speculative(Relation relation, TupleTableSlot *slot,
> uint32 spekToken, bool succeeded)
> {
> bool shouldFree = true;
> HeapTuple tuple = ExecFetchSlotHeapTuple(slot, true, &shouldFree);
>
> /* adjust the tuple's state accordingly */
> if (!succeeded)
> heap_finish_speculative(relation, &slot->tts_tid);
> else
> heap_abort_speculative(relation, &slot->tts_tid);
>
> if (shouldFree)
> pfree(tuple);
> }

According to the comments, if "succeeded = true", the insertion is
completed, and otherwise it's killed. It works, because the only caller
is also passing the argument wrong.

Barring objections, I'll push the attached patch to fix that.

- Heikki

Attachment Content-Type Size
reverse-speculative-succeeded-argument.patch text/x-patch 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ideriha, Takeshi 2019-05-14 11:46:15 RE: Copy data to DSA area
Previous Message Kyotaro HORIGUCHI 2019-05-14 11:13:24 Re: Tab completion for CREATE TYPE