Re: Small code improvement for btree

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

On Wed, Aug 9, 2017 at 11:23 AM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Mon, Aug 7, 2017 at 1:44 PM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>> On Sat, Aug 5, 2017 at 3:29 AM, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>>> 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).
>>
>> Thank you for the information. The macros other than
>> P_INCOMPLETE_SPLIT in btree.h such as P_ISLEAF, P_ISROOT also doesn't
>> return booleans. Should we deal with them as well?
>>
>>>>
>>>>
>>>>> - 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.
>>>
>>
>> I definitely agreed.
>>
>
> Attached updated patch. I'll add it to next CF.
>

Added to the next CF. Feedback and comment are very welcome.

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 Thomas Munro 2017-08-10 03:58:40 Re: Partition-wise join for join between (declaratively) partitioned tables
Previous Message Amit Langote 2017-08-10 02:14:00 Re: dubious error message from partition.c