From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Greg Stark <stark@mit.edu>
Cc: Tan Tran <tankimtran@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: GSoC on WAL-logging hash indexes
Date: Fri, 07 Mar 2014 16:11:47 +0200
Message-ID: <5319D3A3.9070209@vmware.com> (raw)
In-Reply-To: <CA+TgmoacpdE5x3epiwtww_jM3SL5gzV-o6XRG6o0q+W7XrfgzQ@mail.gmail.com>
References: <B444B441-397F-4EDA-8A0C-877B9AF7033B@gmail.com>
<54977A8C-4AF5-4BCC-B021-78E9CA978077@gmail.com>
<CA+TgmoY4X7VKyC4dAwujuTuBoyxE2qSJF9aybhWZjxXWoc6J8w@mail.gmail.com>
<CAM-w4HNGN+eyDzZEaZB_XHLfMCGMqZNZ+2GJpty+PdrDEtzeWg@mail.gmail.com>
<531873E8.6050802@vmware.com>
<CA+TgmoZ=HQDaynaRyppSXfYyfTUKrCbk7arFT6Hati7seNmHvg@mail.gmail.com>
<531992AF.2080306@vmware.com>
<CA+TgmoacpdE5x3epiwtww_jM3SL5gzV-o6XRG6o0q+W7XrfgzQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 03/07/2014 03:48 PM, Robert Haas wrote:
> On Fri, Mar 7, 2014 at 4:34 AM, Heikki Linnakangas
> <hlinnakangas@vmware.com> wrote:
>> >Hmm. You suggested ensuring that a scan always has at least a pin, and split
>> >takes a vacuum-lock. That ought to work. There's no need for the more
>> >complicated maneuvers you described, ISTM that you can just replace the
>> >heavy-weight share lock with holding a pin on the primary page of the
>> >bucket, and an exclusive lock with a vacuum-lock. Note that
>> >_hash_expandtable already takes the exclusive lock conditionally, ie. if it
>> >doesn't get the lock immediately it just gives up. We could do the same with
>> >the cleanup lock.
> We could try that. I assume you mean do*just* what you describe
> here, without the split-in-progress or moved-by-split flags I
> suggested.
Yep.
> The only issue I see with that is that instead of everyone
> piling up on the heavyweight lock, a wait which is interruptible,
> they'd all pile up on the buffer content lwlock, a wait which isn't.
> And splitting a bucket can involve an arbitrary number of I/O
> operations, so that's kind of unappealing. Even checkpoints would be
> blocked until the bucket split completed, which seems unfortunate.
Hmm. I doubt that's a big deal in practice, although I agree it's a bit
ugly.
Once we solve the crash-safety of splits, we actually have the option of
doing the split in many small steps, even when there's no crash
involved. You could for example grab the vacuum-lock, move all the
tuples in the first 5 pages, and then release the lock to give other
backends that are queued up a chance to do their scans/insertions. Then
re-acquire the lock, and continue where you left. Or just bail out and
let the next vacuum or insertion to finish it later.
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-students@postgresql.org
Cc: hlinnakangas@vmware.com, robertmhaas@gmail.com, stark@mit.edu, tankimtran@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: GSoC on WAL-logging hash indexes
In-Reply-To: <5319D3A3.9070209@vmware.com>
References: <B444B441-397F-4EDA-8A0C-877B9AF7033B@gmail.com> <54977A8C-4AF5-4BCC-B021-78E9CA978077@gmail.com> <CA+TgmoY4X7VKyC4dAwujuTuBoyxE2qSJF9aybhWZjxXWoc6J8w@mail.gmail.com> <CAM-w4HNGN+eyDzZEaZB_XHLfMCGMqZNZ+2GJpty+PdrDEtzeWg@mail.gmail.com> <531873E8.6050802@vmware.com> <CA+TgmoZ=HQDaynaRyppSXfYyfTUKrCbk7arFT6Hati7seNmHvg@mail.gmail.com> <531992AF.2080306@vmware.com> <CA+TgmoacpdE5x3epiwtww_jM3SL5gzV-o6XRG6o0q+W7XrfgzQ@mail.gmail.com> <5319D3A3.9070209@vmware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox