Re: Suspicious place in heap_prepare_freeze_tuple()

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Suspicious place in heap_prepare_freeze_tuple()
Date: 2017-07-06 00:37:31
Message-ID: CAD21AoBGYBaEJwhZW=wvbVmix2m9wHJhE-Kb_zTQzs-j_2nnxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 6, 2017 at 1:36 AM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> Teodor Sigaev wrote:
>
>> Playing around freezing tuple I found suspicious piece of code:
>>
>> heap_prepare_freeze_tuple():
>> ...
>> frz->t_infomask = tuple->t_infomask;
>> ...
>> frz->t_infomask &= ~HEAP_XMAX_BITS;
>> frz->xmax = newxmax;
>> if (flags & FRM_MARK_COMMITTED)
>> frz->t_infomask &= HEAP_XMAX_COMMITTED;
>>
>> Seems, in last line it should be a bitwise OR instead of AND. Now this line
>> cleans all bits in t_infomask which later will be copied directly in tuple.
>
> I think you're right.
>

I also think that's right. Should we back-patch it down to 9.3?

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2017-07-06 01:03:37 SCRAM auth and Pgpool-II
Previous Message Michael Paquier 2017-07-05 23:29:52 Re: Re: pg_ctl wait exit code (was Re: [COMMITTERS] pgsql: Additional tests for subtransactions in recovery)