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

Commit1eab7a5

Browse files
committed
Don't call OwnLatch while holding a spinlock. OwnLatch can elog() under
some "can't happen" scenarios, and spinlocks should only be held fora few instructions anyway. As pointed out by Fujii Masao.
1 parent4e97631 commit1eab7a5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/backend/replication/walsender.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Portions Copyright (c) 2010-2010, PostgreSQL Global Development Group
2929
*
3030
* IDENTIFICATION
31-
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.31 2010/09/14 13:35:14 heikki Exp $
31+
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.32 2010/09/15 06:51:19 heikki Exp $
3232
*
3333
*-------------------------------------------------------------------------
3434
*/
@@ -511,15 +511,15 @@ InitWalSnd(void)
511511
else
512512
{
513513
/*
514-
* Found a free slot. Take ownership of the latch and initialize
515-
* the other fields.
514+
* Found a free slot. Reserve it for us.
516515
*/
517-
OwnLatch((Latch*)&walsnd->latch);
518516
walsnd->pid=MyProcPid;
519517
MemSet(&walsnd->sentPtr,0,sizeof(XLogRecPtr));
520-
/* Set MyWalSnd only after it's fully initialized. */
521-
MyWalSnd= (WalSnd*)walsnd;
522518
SpinLockRelease(&walsnd->mutex);
519+
/* don't need the lock anymore */
520+
OwnLatch((Latch*)&walsnd->latch);
521+
MyWalSnd= (WalSnd*)walsnd;
522+
523523
break;
524524
}
525525
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp