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

Commit82358ca

Browse files
committed
Put a critical section around update of hash index metapage. Per
discussion with Qingqing Zhou.
1 parent65d2732 commit82358ca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.49 2005/05/11 01:26:01 neilc Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.50 2005/06/09 18:23:50 tgl Exp $
1212
*
1313
* NOTES
1414
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -421,7 +421,15 @@ _hash_expandtable(Relation rel, Buffer metabuf)
421421
/*
422422
* Okay to proceed with split.Update the metapage bucket mapping
423423
* info.
424+
*
425+
* Since we are scribbling on the metapage data right in the shared
426+
* buffer, any failure in this next little bit leaves us with a big
427+
* problem: the metapage is effectively corrupt but could get written
428+
* back to disk. We don't really expect any failure, but just to be
429+
* sure, establish a critical section.
424430
*/
431+
START_CRIT_SECTION();
432+
425433
metap->hashm_maxbucket=new_bucket;
426434

427435
if (new_bucket>metap->hashm_highmask)
@@ -456,6 +464,9 @@ _hash_expandtable(Relation rel, Buffer metabuf)
456464
if (!_hash_try_getlock(rel,start_nblkno,HASH_EXCLUSIVE))
457465
elog(PANIC,"could not get lock on supposedly new bucket");
458466

467+
/* Done mucking with metapage */
468+
END_CRIT_SECTION();
469+
459470
/*
460471
* Copy bucket mapping info now; this saves re-accessing the meta page
461472
* inside _hash_splitbucket's inner loop. Note that once we drop the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp