Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93cd768

Browse files
committed
Properly acquire buffer lock for page-at-a-time hash vacuum.
In a couple of places, _hash_kill_items was mistakenly called withthe buffer lock not held. Repair.Ashutosh Sharma, per a report from Andreas SeltenreichDiscussion:http://postgr.es/m/87o9wo8o0j.fsf@credativ.de
1 parentf578093 commit93cd768

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

‎src/backend/access/hash/hash.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,17 @@ hashrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
476476
HashScanOpaqueso= (HashScanOpaque)scan->opaque;
477477
Relationrel=scan->indexRelation;
478478

479-
/* Before leaving current page, deal with any killed items */
479+
/*
480+
* Before leaving current page, deal with any killed items.
481+
* Also, ensure that we acquire lock on current page before
482+
* calling _hash_kill_items.
483+
*/
480484
if (so->numKilled>0)
485+
{
486+
LockBuffer(so->hashso_curbuf,BUFFER_LOCK_SHARE);
481487
_hash_kill_items(scan);
488+
LockBuffer(so->hashso_curbuf,BUFFER_LOCK_UNLOCK);
489+
}
482490

483491
_hash_dropscanbuf(rel,so);
484492

@@ -507,9 +515,17 @@ hashendscan(IndexScanDesc scan)
507515
HashScanOpaqueso= (HashScanOpaque)scan->opaque;
508516
Relationrel=scan->indexRelation;
509517

510-
/* Before leaving current page, deal with any killed items */
518+
/*
519+
* Before leaving current page, deal with any killed items.
520+
* Also, ensure that we acquire lock on current page before
521+
* calling _hash_kill_items.
522+
*/
511523
if (so->numKilled>0)
524+
{
525+
LockBuffer(so->hashso_curbuf,BUFFER_LOCK_SHARE);
512526
_hash_kill_items(scan);
527+
LockBuffer(so->hashso_curbuf,BUFFER_LOCK_UNLOCK);
528+
}
513529

514530
_hash_dropscanbuf(rel,so);
515531

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp