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

Commit0cf16cb

Browse files
committed
Don't report stats in LogicalRepApplyLoop() when in xact.
pgstat_report_stat() is only supposed to be called outside of transactions. In5891c7a I added a pgstat_report_stat() call into LogicalRepApplyLoop()'stimeout branch. While not commonly reached inside a transaction, it isreachable (e.g. due to network bottlenecks or the sender being stalled / slowfor some reason).To fix, add a !IsTransactionState() check.No test added because there's no easy way to reproduce this case withoutpatching the code.Reported-By: Erik Rijkers <er@xs4all.nl>Discussion:https://postgr.es/m/b3463b8c-2328-dcac-0136-af95715493c1@xs4all.nl
1 parent8d33412 commit0cf16cb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎src/backend/replication/logical/worker.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,9 +2883,14 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
28832883

28842884
/*
28852885
* Force reporting to ensure long idle periods don't lead to
2886-
* arbitrarily delayed stats.
2886+
* arbitrarily delayed stats. Stats can only be reported outside
2887+
* of (implicit or explicit) transactions. That shouldn't lead to
2888+
* stats being delayed for long, because transactions are either
2889+
* sent as a whole on commit or streamed. Streamed transactions
2890+
* are spilled to disk and applied on commit.
28872891
*/
2888-
pgstat_report_stat(true);
2892+
if (!IsTransactionState())
2893+
pgstat_report_stat(true);
28892894
}
28902895
}
28912896

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp