Re: Small code improvement for btree

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small code improvement for btree
Date: 2017-08-04 18:29:22
Message-ID: CAH2-WznC3ijK3fMU97sr7Hx_Pc4ptCfBc2XRA_EfJd0XwcCHCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 4, 2017 at 11:12 AM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> Interesting. We learned elsewhere that it's better to integrate the
> "!= 0" test as part of the macro definition; so a
> better formulation of this patch would be to change the
> P_INCOMPLETE_SPLIT macro and omit the comparison in the Assert. (See
> commit 594e61a1de03 for an example).
>
>
>> - LockBuffer(hbuffer, BUFFER_LOCK_SHARE);
>> + LockBuffer(hbuffer, BT_READ);

+1.

One Linus Torvalds rant that I actually agreed with was a rant against
the use of bool as a type in C code. It's fine, as long as you never
forget that it's actually just another integer.

> I think BT_READ and BT_WRITE are useless, and I'd rather get rid of
> them ...

Fair enough, but we should either use them consistently or not at all.
I'm not especially concerned about which, as long as it's one of those
two.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-08-04 18:45:48 Re: pgsql 10: hash indexes testing
Previous Message Amit Kapila 2017-08-04 18:15:40 Re: pgsql 10: hash indexes testing