Re: Hash Indexes
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>,
Jesper Pedersen <jesper.pedersen@redhat.com>, Mithun Cy <mithun.cy@enterprisedb.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2016-12-13T18:00:21Z
Lists: pgsql-hackers
Attachments
- remove-hash-wrtbuf.patch (text/x-patch) patch
On Mon, Dec 12, 2016 at 9:21 PM, Amit Kapila <amit.kapila16@gmail.com> wrote: > The reason is to make the operations consistent in master and standby. > In WAL patch, for clearing the SPLIT_CLEANUP flag, we write a WAL and > if we don't release the lock after writing a WAL, the operation can > appear on standby even before on master. Currently, without WAL, > there is no benefit of doing so and we can fix by using > MarkBufferDirty, however, I thought it might be simpler to keep it > this way as this is required for enabling WAL. OTOH, we can leave > that for WAL patch. Let me know which way you prefer? It's not required for enabling WAL. You don't *have* to release and reacquire the buffer lock; in fact, that just adds overhead. You *do* have to be aware that the standby will perhaps see the intermediate state, because it won't hold the lock throughout. But that does not mean that the master must release the lock. >> I don't think we should be afraid to call MarkBufferDirty() instead of >> going through these (fairly stupid) hasham-specific APIs. > > Right and anyway we need to use it at many more call sites when we > enable WAL for hash index. I propose the attached patch, which removes _hash_wrtbuf() and causes those functions which previously called it to do MarkBufferDirty() directly. Aside from hopefully fixing the bug we're talking about here, this makes the logic in several places noticeably less contorted. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().
- 25216c989384 10.0 landed
-
Fix race introduced by 6d46f4783efe457f74816a75173eb23ed8930020.
- 2f4193c3509a 10.0 cited
-
Improve hash index bucket split behavior.
- 6d46f4783efe 10.0 landed
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited