postgresql/src/backend
Andres Freund 0cf16cb8ca Don't report stats in LogicalRepApplyLoop() when in xact.
pgstat_report_stat() is only supposed to be called outside of transactions. In
5891c7a8ed I added a pgstat_report_stat() call into LogicalRepApplyLoop()'s
timeout branch. While not commonly reached inside a transaction, it is
reachable (e.g. due to network bottlenecks or the sender being stalled / slow
for some reason).

To fix, add a !IsTransactionState() check.

No test added because there's no easy way to reproduce this case without
patching the code.

Reported-By: Erik Rijkers <er@xs4all.nl>
Discussion: https://postgr.es/m/b3463b8c-2328-dcac-0136-af95715493c1@xs4all.nl
2022-05-12 18:54:26 -07:00
..
access Add 'static' to file-local variables missing it. 2022-05-12 12:39:33 -07:00
bootstrap pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
catalog Add missing binary_upgrade.h includes. 2022-05-12 12:39:33 -07:00
commands Add missing binary_upgrade.h includes. 2022-05-12 12:39:33 -07:00
executor Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
foreign Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
jit Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
lib Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
libpq Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
main Fix collection of typos in the code and the documentation 2022-03-15 11:29:35 +09:00
nodes Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
optimizer Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
parser Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
partitioning Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
regex Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
replication Don't report stats in LogicalRepApplyLoop() when in xact. 2022-05-12 18:54:26 -07:00
rewrite Fix incautious CTE matching in rewriteSearchAndCycle(). 2022-04-23 12:16:12 -04:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
storage Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
tcop Add 'static' to file-local variables missing it. 2022-05-12 12:39:33 -07:00
tsearch Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
utils Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
.gitignore
common.mk
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00