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

Commit2d115e4

Browse files
committed
Fix various shortcomings of the new PrivateRefCount infrastructure.
As noted by Tom Lane the improvements in4b4b680 had the problemthat in some situations we searched, entered and modified entries inthe private refcount hash while holding a spinlock. I had tried tokeep the logic entirely local to PinBuffer_Locked(), but that's notreally possible given it's called with a spinlock held...Besides being disadvantageous from a performance point of view, thisalso has problems with error handling safety. If we failed insertingan entry into the hashtable due to an out of memory error, we'd errorout with a held spinlock. Not good.Change the way private refcounts are manipulated: Before a buffer canbe tracked an entry has to be reserved usingReservePrivateRefCountEntry(); then, if a entry is not found usingGetPrivateRefCountEntry(), it can be entered withNewPrivateRefCountEntry().Also take advantage of the fact that PinBuffer_Locked() currently isnever called for buffers that already have been pinned by the currentbackend and don't search the private refcount entries for preexistinglocal pins. That results in a small, but measurable, performanceimprovement.Additionally make ReleaseBuffer() always call UnpinBuffer() for sharedbuffers. That avoids duplicating work in an eventual UnpinBuffer()call that already has been done in ReleaseBuffer() and also saves somecode.Per discussion with Tom Lane.Discussion: 15028.1418772313@sss.pgh.pa.us
1 parent4ea51cd commit2d115e4

File tree

1 file changed

+195
-164
lines changed

1 file changed

+195
-164
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp