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

Commitcaa3c42

Browse files
committed
Don't call elog() while holding spinlock.
Previously UpdateSpillStats() called elog(DEBUG2) while holdingthe spinlock even though the local variables that the elog() accessesdon't need to be protected by the lock. Since spinlocks are intendedfor very short-term locks, they should not be used when callingelog(DEBUG2). So this commit moves that elog() out of spinlock period.Author: Kyotaro HoriguchiReviewed-by: Amit Kapila and Fujii MasaoDiscussion:https://postgr.es/m/20200602.161518.1399689010416646074.horikyota.ntt@gmail.com
1 parente641b2a commitcaa3c42

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎src/backend/replication/walsender.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,17 +3685,15 @@ UpdateSpillStats(LogicalDecodingContext *ctx)
36853685
{
36863686
ReorderBuffer*rb=ctx->reorder;
36873687

3688-
SpinLockAcquire(&MyWalSnd->mutex);
3689-
3690-
MyWalSnd->spillTxns=rb->spillTxns;
3691-
MyWalSnd->spillCount=rb->spillCount;
3692-
MyWalSnd->spillBytes=rb->spillBytes;
3693-
36943688
elog(DEBUG2,"UpdateSpillStats: updating stats %p %lld %lld %lld",
36953689
rb,
36963690
(long long)rb->spillTxns,
36973691
(long long)rb->spillCount,
36983692
(long long)rb->spillBytes);
36993693

3694+
SpinLockAcquire(&MyWalSnd->mutex);
3695+
MyWalSnd->spillTxns=rb->spillTxns;
3696+
MyWalSnd->spillCount=rb->spillCount;
3697+
MyWalSnd->spillBytes=rb->spillBytes;
37003698
SpinLockRelease(&MyWalSnd->mutex);
37013699
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp