Content-Length: 287289 | pFad | http://github.com/postgrespro/postgres/commit/2f4193c3509a822c55cc0eae77e7788806d9b022

C4 Fix race introduced by 6d46f4783efe457f74816a75173eb23ed8930020. · postgrespro/postgres@2f4193c · GitHub
Skip to content

Commit 2f4193c

Browse files
committed
Fix race introduced by 6d46f47.
It's possible for the metapage contents to change after we release the lock, so we must read them before releasing the lock. Amit Kapila. Submitted in response to a trouble report from Andreas Seltenreich, though it is not certain this fixes the problem.
1 parent 0e50af2 commit 2f4193c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/backend/access/hash/hashpage.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,13 +653,21 @@ _hash_expandtable(Relation rel, Buffer metabuf)
653653
*/
654654
if (H_NEEDS_SPLIT_CLEANUP(oopaque))
655655
{
656+
/*
657+
* Copy bucket mapping info now; refer to the comment in code below
658+
* where we copy this information before calling _hash_splitbucket
659+
* to see why this is okay.
660+
*/
661+
maxbucket = metap->hashm_maxbucket;
662+
highmask = metap->hashm_highmask;
663+
lowmask = metap->hashm_lowmask;
664+
656665
/* Release the metapage lock. */
657666
_hash_chgbufaccess(rel, metabuf, HASH_READ, HASH_NOLOCK);
658667

659668
hashbucketcleanup(rel, old_bucket, buf_oblkno, start_oblkno, NULL,
660-
metap->hashm_maxbucket, metap->hashm_highmask,
661-
metap->hashm_lowmask, NULL,
662-
NULL, true, NULL, NULL);
669+
maxbucket, highmask, lowmask, NULL, NULL, true,
670+
NULL, NULL);
663671

664672
_hash_dropbuf(rel, buf_oblkno);
665673

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/2f4193c3509a822c55cc0eae77e7788806d9b022

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy