Re: Re: BUG #15039: some question about hash index code
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: 自己 <zoulx1982@163.com>
Cc: pgsql-bugs@lists.postgresql.org, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-02-01T06:51:53Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- fix_markbufdirty_hash_index_v1.patch (application/octet-stream) patch v1
- fix_markbufdirty_hash_index_v1.1.patch (application/octet-stream) patch v1
On Wed, Jan 31, 2018 at 6:14 PM, Amit Kapila <amit.kapila16@gmail.com> wrote: > On Wed, Jan 31, 2018 at 5:57 PM, 自己 <zoulx1982@163.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
Commits
-
Fix possible failure to mark hash metapage dirty.
- b94988fad561 10.2 landed
- ad25a6b1f25b 11.0 landed