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

Commit0b55aaa

Browse files
committed
Fix race in dsm_unpin_segment() when handles are reused.
Teach dsm_unpin_segment() to skip segments that are in the processof being destroyed by another backend, when searching for a handle.Such a segment cannot possibly be the one we are looking for, evenif its handle matches. Another slot might hold a recently createdsegment that has the same handle value by coincidence, and we needto keep searching for that one.The bug caused rare "cannot unpin a segment that is not pinned"errors on 10 and 11. Similar to commit6c0fb94 for dsm_attach().Back-patch to 10, where dsm_unpin_segment() landed.Author: Thomas MunroReported-by: Justin PryzbyTested-by: Justin Pryzby (along with other recent DSA/DSM fixes)Discussion:https://postgr.es/m/20190216023854.GF30291@telsasoft.com
1 parentbc6d7eb commit0b55aaa

File tree

1 file changed

+2
-2
lines changed
  • src/backend/storage/ipc

1 file changed

+2
-2
lines changed

‎src/backend/storage/ipc/dsm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,8 @@ dsm_unpin_segment(dsm_handle handle)
844844
LWLockAcquire(DynamicSharedMemoryControlLock,LW_EXCLUSIVE);
845845
for (i=0;i<dsm_control->nitems;++i)
846846
{
847-
/* Skip unused slots. */
848-
if (dsm_control->item[i].refcnt==0)
847+
/* Skip unused slots and segments that are concurrently going away. */
848+
if (dsm_control->item[i].refcnt<=1)
849849
continue;
850850

851851
/* If we've found our handle, we can stop searching. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp