From: | Antonin Houska <ah(at)cybertec(dot)at> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Concurrent calls of _hash_getnewbuf() |
Date: | 2015-03-30 09:26:58 |
Message-ID: | 18588.1427707618@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
When doing my experiments with bucket split ([1]), I noticed a comment that
_hash_getnewbuf should not be called concurrently. However, there's no
synchronization of calls from _hash_splitbucket in HEAD. I could reproduce
such concurrent calls using gdb (multiple bucket splits in progress at a
time).
When the function is called from _hash_getovflpage, content lock of metapage
buffer seems to be (mis)used to synchronize the calls:
/*
* Fetch the page with _hash_getnewbuf to ensure smgr's idea of the
* relation length stays in sync with ours. XXX It's annoying to do this
* with metapage write lock held; would be better to use a lock that
* doesn't block incoming searches.
*/
newbuf = _hash_getnewbuf(rel, blkno, MAIN_FORKNUM);
I think it'd also be the easiest fix for _hash_splitbucket. Or should a
separate ("regular") lock be introduced and used and used in both cases?
[1] http://www.postgresql.org/message-id/32423.1427413442@localhost
--
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de, http://www.cybertec.at
Attachment | Content-Type | Size |
---|---|---|
hash_getnewbuf.patch | text/x-diff | 645 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2015-03-30 10:24:55 | Re: Index-only scans with btree_gist |
Previous Message | Albe Laurenz | 2015-03-30 08:27:49 | Re: Rounding to even for numeric data type |