Re: Re: BUG #15039: some question about hash index code

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: 自己 <zoulx1982(at)163(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Re: BUG #15039: some question about hash index code
Date: 2018-02-01 06:51:53
Message-ID: CAA4eK1+WdnOcYAx5RMy0uJ9Y-0A-yzo1hYcs+a4etZc6KhY-9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Jan 31, 2018 at 6:14 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Wed, Jan 31, 2018 at 5:57 PM, 自己 <zoulx1982(at)163(dot)com> wrote:
>> thank you for your quick reply.
>> and i have another question, for the following code, whether exist such
>> scene : page_found is false and
>> newmapbuf is invalid, if so, may be the statement MarkBufferDirty(metabuf);
>> should be placed outside the if statement ?
>>
>
> On a quick look, your observation seems to be right and I think in
> this function we might call markbufferdirty twice for meta page which
> doesn't seem to be required.
>

Attached patch fix_markbufdirty_hash_index_v1.patch fixes the problem
by calling MarkBufferDirty at the appropriate place in the code.
However, I noticed that we might end up calling MarkBufferDirty twice
for metapage in _hash_addovflpage. I think we can easily avoid that
as is done in patch fix_markbufdirty_hash_index_v1.1.patch.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
fix_markbufdirty_hash_index_v1.patch application/octet-stream 574 bytes
fix_markbufdirty_hash_index_v1.1.patch application/octet-stream 1.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-02-01 08:58:29 BUG #15042: Parition by list using enums odd behaviour
Previous Message Bruce Momjian 2018-01-31 21:25:44 Re: [BUGS] BUG #14898: pg_upgrade documentation is misleading

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-02-01 06:56:24 constraint exclusion and nulls in IN (..) clause
Previous Message Michael Paquier 2018-02-01 06:47:00 Re: [HACKERS] taking stdbool.h into use