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

Commitf6c4a86

Browse files
committed
Fix RBM_ZERO_AND_LOCK mode to not acquire lock on local buffers.
Commit81c4508 introduced a new RBM_ZERO_AND_LOCK mode to ReadBuffer, whichtakes a lock on the buffer before zeroing it. However, you cannot take alock on a local buffer, and you got a segfault instead. The version of thatpatch committed to master included a check for !isLocalBuf, and thereforedidn't crash, but oddly I missed that in the back-patched versions. Thispatch adds that check to the back-branches too.RBM_ZERO_AND_LOCK mode is only used during WAL replay, and in hash indexes.WAL replay only deals with shared buffers, so the only way to trigger thebug is with a temporary hash index.Reported by Artem Ignatyev, analysis by Tom Lane.
1 parentdd75518 commitf6c4a86

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
494494
* (Note that we cannot use LockBuffer() of LockBufferForCleanup() here,
495495
* because they assert that the buffer is already valid.)
496496
*/
497-
if (mode==RBM_ZERO_AND_LOCK||mode==RBM_ZERO_AND_CLEANUP_LOCK)
497+
if ((mode==RBM_ZERO_AND_LOCK||mode==RBM_ZERO_AND_CLEANUP_LOCK)&&
498+
!isLocalBuf)
498499
LWLockAcquire(bufHdr->content_lock,LW_EXCLUSIVE);
499500

500501
if (isLocalBuf)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp