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

Commit14f98e0

Browse files
committed
hio: Release extension lock before initializing page / pinning VM
PageInit() while holding the extension lock is unnecessary after0d1fe9fstarted to use RBM_ZERO_AND_LOCK - nobody can look at the new page before werelease the page lock. PageInit() zeroes the page, which isn't that cheap, sodeferring it until after the extension lock is released seems like a good idea.Doing visibilitymap_pin() while holding the extension lock, introduced in7db0cd2, looks like an accident. Due to the restrictions onHEAP_INSERT_FROZEN it's unlikely to be a performance issue, but it still seemsbetter to move it out. We also are doing the visibilitymap_pin() whileholding the buffer lock, which will be fixed in a separate commit.Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Discussion:http://postgr.es/m/419312fd-9255-078c-c3e3-f0525f911d7f@iki.fi
1 parent0070b66 commit14f98e0

File tree

1 file changed

+7
-7
lines changed
  • src/backend/access/heap

1 file changed

+7
-7
lines changed

‎src/backend/access/heap/hio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,13 @@ RelationGetBufferForTuple(Relation relation, Size len,
623623
*/
624624
buffer=ReadBufferBI(relation,P_NEW,RBM_ZERO_AND_LOCK,bistate);
625625

626+
/*
627+
* Release the file-extension lock; it's now OK for someone else to extend
628+
* the relation some more.
629+
*/
630+
if (needLock)
631+
UnlockRelationForExtension(relation,ExclusiveLock);
632+
626633
/*
627634
* We need to initialize the empty new page. Double-check that it really
628635
* is empty (this should never happen, but if it does we don't want to
@@ -647,13 +654,6 @@ RelationGetBufferForTuple(Relation relation, Size len,
647654
visibilitymap_pin(relation,BufferGetBlockNumber(buffer),vmbuffer);
648655
}
649656

650-
/*
651-
* Release the file-extension lock; it's now OK for someone else to extend
652-
* the relation some more.
653-
*/
654-
if (needLock)
655-
UnlockRelationForExtension(relation,ExclusiveLock);
656-
657657
/*
658658
* Lock the other buffer. It's guaranteed to be of a lower page number
659659
* than the new page. To conform with the deadlock prevent rules, we ought

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp