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

Commitd699ba4

Browse files
committed
Fix WakeupWaiters() to not wake up an exclusive locker unnecessarily.
WakeupWaiters() is supposed to wake up all LW_WAIT_UNTIL_FREE waiters ofthe slot, but the loop incorrectly also woke up the first LW_EXCLUSIVEwaiter, if there was no LW_WAIT_UNTIL_FREE waiters in the queue.Noted by Andres Freund. This code is new in 9.4, so no backpatching.
1 parent6c2744f commitd699ba4

File tree

1 file changed

+5
-4
lines changed
  • src/backend/access/transam

1 file changed

+5
-4
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,15 +1842,14 @@ WakeupWaiters(XLogRecPtr EndPos)
18421842
slot->xlogInsertingAt=EndPos;
18431843

18441844
/*
1845-
* See if there are any waiters that need to be woken up.
1845+
* See if there are any LW_WAIT_UNTIL_FREE waiters that need to be woken
1846+
* up. They are always in the front of the queue.
18461847
*/
18471848
head=slot->head;
18481849

1849-
if (head!=NULL)
1850+
if (head!=NULL&&head->lwWaitMode==LW_WAIT_UNTIL_FREE)
18501851
{
18511852
proc=head;
1852-
1853-
/* LW_WAIT_UNTIL_FREE waiters are always in the front of the queue */
18541853
next=proc->lwWaitLink;
18551854
while (next&&next->lwWaitMode==LW_WAIT_UNTIL_FREE)
18561855
{
@@ -1862,6 +1861,8 @@ WakeupWaiters(XLogRecPtr EndPos)
18621861
slot->head=next;
18631862
proc->lwWaitLink=NULL;
18641863
}
1864+
else
1865+
head=NULL;
18651866

18661867
/* We are done updating shared state of the lock itself. */
18671868
SpinLockRelease(&slot->mutex);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp